diff options
author | Matthew Barth <msbarth@us.ibm.com> | 2017-06-02 16:29:09 -0500 |
---|---|---|
committer | Matthew Barth <msbarth@us.ibm.com> | 2017-06-26 09:19:56 -0500 |
commit | 9e741ed099a77ed2638b852027e751b90f67450d (patch) | |
tree | 30045f61eb643611f58b7337ee96655751414327 /control/zone.hpp | |
parent | cec5ab766709af9b713f94576b6f05bf63fc0718 (diff) | |
download | phosphor-fan-presence-9e741ed099a77ed2638b852027e751b90f67450d.tar.gz phosphor-fan-presence-9e741ed099a77ed2638b852027e751b90f67450d.zip |
Properties stored of different types
Allow properties stored for processing events to be of types other than
bool
Change-Id: Ie1dde5aca562c9958bdff6fa3d1b19d3154b2c6d
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Diffstat (limited to 'control/zone.hpp')
-rw-r--r-- | control/zone.hpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/control/zone.hpp b/control/zone.hpp index bd6e080..1af0c22 100644 --- a/control/zone.hpp +++ b/control/zone.hpp @@ -86,10 +86,11 @@ class Zone * @param[in] property - Property name * @param[in] value - Property value */ + template <typename T> void setPropertyValue(const char* object, const char* interface, const char* property, - bool value) + T value) { _properties[object][interface][property] = value; }; @@ -103,11 +104,13 @@ class Zone * * @return - The property value */ + template <typename T> inline auto getPropertyValue(const std::string& object, const std::string& interface, const std::string& property) { - return _properties[object][interface][property]; + return sdbusplus::message::variant_ns::get<T>( + _properties[object][interface][property]); }; private: @@ -143,7 +146,7 @@ class Zone std::map<std::string, std::map<std::string, std::map<std::string, - bool>>> _properties; + PropertyVariantType>>> _properties; /** * @brief Map of active fan control allowed by groups @@ -169,12 +172,11 @@ class Zone * @param[in] prop - the property name * @param[out] value - the value of the property */ - template <typename T> static void getProperty(sdbusplus::bus::bus& bus, const std::string& path, const std::string& iface, const std::string& prop, - T& value); + PropertyVariantType& value); /** * @brief Dbus signal change callback handler |