xref: /openbmc/phosphor-hwmon/hwmon.cpp (revision c9c818ed854f23a87dd77c2209b6a27805825adb)
109791857SPatrick Venture #include "hwmon.hpp"
209791857SPatrick Venture 
3043d3230SPatrick Venture namespace hwmon
4043d3230SPatrick Venture {
509791857SPatrick Venture 
getAttributes(const std::string & type,Attributes & attributes)609791857SPatrick Venture bool getAttributes(const std::string& type, Attributes& attributes)
709791857SPatrick Venture {
8*c9c818edSPatrick Venture     // clang-format off
9043d3230SPatrick Venture     auto a =
10*c9c818edSPatrick Venture         std::find_if(
11*c9c818edSPatrick Venture             typeAttrMap.begin(),
12*c9c818edSPatrick Venture             typeAttrMap.end(),
13*c9c818edSPatrick Venture             [&](const auto& e)
14*c9c818edSPatrick Venture             {
15*c9c818edSPatrick Venture                 return type == getHwmonType(e);
16*c9c818edSPatrick Venture             });
17*c9c818edSPatrick Venture     // clang-format on
1809791857SPatrick Venture 
1909791857SPatrick Venture     if (a == typeAttrMap.end())
2009791857SPatrick Venture     {
2109791857SPatrick Venture         return false;
2209791857SPatrick Venture     }
2309791857SPatrick Venture 
2409791857SPatrick Venture     attributes = *a;
2509791857SPatrick Venture     return true;
2609791857SPatrick Venture }
2709791857SPatrick Venture 
2809791857SPatrick Venture } //  namespace hwmon
29