control: Pair profiles with name as key
Include the profiles of a configuration object in combination with its
name to construct a unique key for building the complete fan control
configuration. This is necessary for supporting the zones, groups, and
events configurations.
Tested:
Object name and list of profiles construct key
Profile objects always contain an empty list of profiles
Fan objects may or may not contain a list of profiles
Change-Id: I4be7229e3fb695d845d60159d0f08f601512c812
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json/config_base.hpp b/control/json/config_base.hpp
index 3184cb5..6b060c1 100644
--- a/control/json/config_base.hpp
+++ b/control/json/config_base.hpp
@@ -57,6 +57,20 @@
return _name;
}
+ /**
+ * @brief Get the configuration object's list of profiles
+ *
+ * Gets the list of profiles this configuration object belongs to if any
+ * are configured, otherwise an empty list of profiles results in the
+ * object always being included in the configuration.
+ *
+ * @return List of profiles the configuration object belongs to
+ */
+ inline const auto& getProfiles() const
+ {
+ return _profiles;
+ }
+
protected:
/**
* @brief Determines the data type of a JSON configured parameter that is
@@ -98,6 +112,13 @@
"Unsupported data type for JSON object's value");
}
+ /**
+ * Profiles this configuration object belongs to (OPTIONAL).
+ * Otherwise always include this object in the configuration
+ * when no profiles are given
+ */
+ std::vector<std::string> _profiles;
+
private:
/* Name of the configuration object */
std::string _name;