Patrick Venture | 0979185 | 2018-04-17 17:40:00 -0700 | [diff] [blame] | 1 | #include "hwmon.hpp" |
| 2 | |
Patrick Venture | 043d323 | 2018-08-31 10:10:53 -0700 | [diff] [blame] | 3 | namespace hwmon |
| 4 | { |
Patrick Venture | 0979185 | 2018-04-17 17:40:00 -0700 | [diff] [blame] | 5 | |
| 6 | bool getAttributes(const std::string& type, Attributes& attributes) |
| 7 | { |
Patrick Venture | c9c818e | 2018-09-04 09:44:49 -0700 | [diff] [blame] | 8 | // clang-format off |
Patrick Venture | 043d323 | 2018-08-31 10:10:53 -0700 | [diff] [blame] | 9 | auto a = |
Patrick Venture | c9c818e | 2018-09-04 09:44:49 -0700 | [diff] [blame] | 10 | std::find_if( |
| 11 | typeAttrMap.begin(), |
| 12 | typeAttrMap.end(), |
| 13 | [&](const auto& e) |
| 14 | { |
| 15 | return type == getHwmonType(e); |
| 16 | }); |
| 17 | // clang-format on |
Patrick Venture | 0979185 | 2018-04-17 17:40:00 -0700 | [diff] [blame] | 18 | |
| 19 | if (a == typeAttrMap.end()) |
| 20 | { |
| 21 | return false; |
| 22 | } |
| 23 | |
| 24 | attributes = *a; |
| 25 | return true; |
| 26 | } |
| 27 | |
Patrick Venture | 043d323 | 2018-08-31 10:10:53 -0700 | [diff] [blame] | 28 | } // namespace hwmon |