control: Complete profile configuration parsing

Profiles' have an active state that are determined by a given method
within the JSON configuration. Each method for determining a profile's
active state is mapped from its JSON configuration method name to the
handler function that is implemented to parse and return the profile's
active state based on the configuration. At this time, only an `all_of`
active state method is supported where all of the provided list of dbus
properties must match their given value for the profile to be active.

Tested:
    Profile method parsed and active state set appropriately

Change-Id: I258ecabccb849b2fa2662a157d6cb108af2c9886
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json/profile.hpp b/control/json/profile.hpp
index ed80226..eacb1dc 100644
--- a/control/json/profile.hpp
+++ b/control/json/profile.hpp
@@ -24,6 +24,7 @@
 {
 
 using json = nlohmann::json;
+using methodHandler = std::function<bool(const json&)>;
 
 /**
  * @class Profile - Represents a configured fan control profile
@@ -58,9 +59,56 @@
      */
     Profile(sdbusplus::bus::bus& bus, const json& jsonObj);
 
+    /**
+     * @brief Get the active state
+     *
+     * @return The active state of the profile
+     */
+    inline bool isActive() const
+    {
+        return _active;
+    }
+
   private:
     /* The sdbusplus bus object */
     sdbusplus::bus::bus& _bus;
+
+    /* Active state of the profile */
+    bool _active;
+
+    /* Supported methods to their corresponding handler functions */
+    static const std::map<std::string, methodHandler> _methods;
+
+    /**
+     * @brief Parse and set the profile's active state
+     *
+     * @param[in] jsonObj - JSON object for the profile
+     *
+     * Sets the active state of the profile using the configured method of
+     * determining its active state.
+     */
+    void setActive(const json& jsonObj);
+
+    /**
+     * @brief An active state method where all must be true
+     *
+     * @param[in] method - JSON for the profile's method
+     *
+     * Active state method that takes a list of configured dbus properties where
+     * all of those properties must equal their configured values to set the
+     * profile to be active.
+     *
+     * "name": "all_of",
+     * "properties": [
+     *     {
+     *         "path": "[DBUS PATH]",
+     *         "interface": "[DBUS INTERFACE]",
+     *         "property": "[DBUS PROPERTY]",
+     *         "value": [VALUE TO BE ACTIVE]
+     *     }
+     * ]
+     */
+    static bool allOf(const json& method);
 };
 
 } // namespace phosphor::fan::control::json