Matthew Barth | 38a93a8 | 2017-05-11 14:12:27 -0500 | [diff] [blame^] | 1 | #pragma once |
| 2 | |
| 3 | namespace phosphor |
| 4 | { |
| 5 | namespace fan |
| 6 | { |
| 7 | namespace control |
| 8 | { |
| 9 | namespace handler |
| 10 | { |
| 11 | |
| 12 | /** |
| 13 | * @brief A handler function to set/update a property |
| 14 | * @details Sets or updates a property's value determined by a combination of |
| 15 | * an object's path and property names |
| 16 | * |
| 17 | * @param[in] path - Object's path name |
| 18 | * @param[in] property - Object's property name |
| 19 | * |
| 20 | * @return Lambda function |
| 21 | * A lambda function to set/update the property value |
| 22 | */ |
| 23 | template <typename T> |
| 24 | auto setProperty(const char* path, const char* property) |
| 25 | { |
| 26 | return [=](auto& zone, T&& arg) |
| 27 | { |
| 28 | zone.setPropertyValue(path, property, std::forward<T>(arg)); |
| 29 | }; |
| 30 | } |
| 31 | |
| 32 | } // namespace handler |
| 33 | } // namespace control |
| 34 | } // namespace fan |
| 35 | } // namespace phosphor |