summaryrefslogtreecommitdiffstats
path: root/control/handlers.hpp
blob: 0503c534753ff89701931b7f7884bbbb964d1ebf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once

namespace phosphor
{
namespace fan
{
namespace control
{
namespace handler
{

/**
 * @brief A handler function to set/update a property
 * @details Sets or updates a property's value determined by a combination of
 * an object's path and property names
 *
 * @param[in] path - Object's path name
 * @param[in] property - Object's property name
 *
 * @return Lambda function
 *     A lambda function to set/update the property value
 */
template <typename T>
auto setProperty(const char* path, const char* property)
{
    return [=](auto& zone, T&& arg)
    {
        zone.setPropertyValue(path, property, std::forward<T>(arg));
    };
}

} // namespace handler
} // namespace control
} // namespace fan
} // namespace phosphor
OpenPOWER on IntegriCloud