regulators: Implements support for configuration
Enhance the configuration file parser to support the configuration
element.
Signed-off-by: Bob King <Bob_King@wistron.com>
Change-Id: I6862c9784a3ade6378eb7a1d19a174f1515fc845
diff --git a/phosphor-regulators/src/config_file_parser.hpp b/phosphor-regulators/src/config_file_parser.hpp
index 35178ea..251f236 100644
--- a/phosphor-regulators/src/config_file_parser.hpp
+++ b/phosphor-regulators/src/config_file_parser.hpp
@@ -202,6 +202,19 @@
parseChassisArray(const nlohmann::json& element);
/**
+ * Parses a JSON element containing a configuration.
+ *
+ * Returns the corresponding C++ Configuration object.
+ *
+ * Throws an exception if parsing fails.
+ *
+ * @param element JSON element
+ * @return Configuration object
+ */
+std::unique_ptr<Configuration>
+ parseConfiguration(const nlohmann::json& element);
+
+/**
* Parses a JSON element containing a device.
*
* Returns the corresponding C++ Device object.
@@ -436,6 +449,25 @@
parseRuleArray(const nlohmann::json& element);
/**
+ * Parses the "rule_id" or "actions" property in a JSON element.
+ *
+ * The element must contain one property or the other but not both.
+ *
+ * If the element contains a "rule_id" property, the corresponding C++
+ * RunRuleAction object is returned.
+ *
+ * If the element contains an "actions" property, the corresponding C++ Action
+ * objects are returned.
+ *
+ * Throws an exception if parsing fails.
+ *
+ * @param element JSON element
+ * @return vector of Action objects
+ */
+std::vector<std::unique_ptr<Action>>
+ parseRuleIDOrActionsProperty(const nlohmann::json& element);
+
+/**
* Parses a JSON element containing a run_rule action.
*
* Returns the corresponding C++ RunRuleAction object.