control: Get property from cache and add objects

Add the ability to get a property from the cached set of dbus objects.
In the case that the property is not found in the cache, objects can be
added using the getManagedObjects method to retrieve all objects for a
given service. The service for the missing dbus object is attempted to
be retrieved from the cached set of services (and added if not cached),
then the path where the ObjectManager interface exists for the service
is determined so the getManagedObjects method call can be made. In the
case that the ObjectManager interface is not present on the service, the
individual dbus object is cached from dbus directly.

Change-Id: I3ddcf34cfba906ef3d78a755dec96a91971bc27f
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json/manager.hpp b/control/json/manager.hpp
index 88a2b1f..b414c62 100644
--- a/control/json/manager.hpp
+++ b/control/json/manager.hpp
@@ -260,6 +260,48 @@
                                          const std::string& intf);
 
     /**
+     * @brief Get all the object paths for a given service and interface from
+     * the cached dataset and try to add all the services for the given
+     * interface when no paths are found and then attempt to get all the object
+     * paths again
+     *
+     * @param[in] serv - Service name to get paths for
+     * @param[in] intf - Interface to get paths for
+     *
+     * @return The cached object paths
+     */
+    std::vector<std::string> getPaths(const std::string& serv,
+                                      const std::string& intf);
+
+    /**
+     * @brief Add objects to the cached dataset by first using
+     * `getManagedObjects` for the same service providing the given path and
+     * interface or just add the single object of the given path, interface, and
+     * property if that fails.
+     *
+     * @param[in] path - Dbus object's path
+     * @param[in] intf - Dbus object's interface
+     * @param[in] prop - Dbus object's property
+     *
+     * @throws - DBusMethodError
+     * Throws a DBusMethodError when the the service is failed to be found or
+     * when the `getManagedObjects` method call fails
+     */
+    void addObjects(const std::string& path, const std::string& intf,
+                    const std::string& prop);
+
+    /**
+     * @brief Get an object's property value
+     *
+     * @param[in] path - Dbus object's path
+     * @param[in] intf - Dbus object's interface
+     * @param[in] prop - Dbus object's property
+     */
+    const std::optional<PropertyVariantType>
+        getProperty(const std::string& path, const std::string& intf,
+                    const std::string& prop);
+
+    /**
      * @brief Set/update an object's property value
      *
      * @param[in] path - Dbus object's path
@@ -420,6 +462,18 @@
                                           const std::string& intf);
 
     /**
+     * @brief Find all the paths for a given service and interface from the
+     * cached dataset
+     *
+     * @param[in] serv - Service name to get paths for
+     * @param[in] intf - Interface to get paths for
+     *
+     * @return - The cached object paths
+     */
+    std::vector<std::string> findPaths(const std::string& serv,
+                                       const std::string& intf);
+
+    /**
      * @brief Parse and set the configured profiles from the profiles JSON file
      *
      * Retrieves the optional profiles JSON configuration file, parses it, and