Create Activation dbus object

Monitor the creation of new software version dbus objects and
create an activation dbus object SOFTWARE_OBJPATH/<ID>.
Save them in a persistent map with the corresponding version id,
add the real version id number to the map and to the dbus
object path once that's available.

Change-Id: I35c2f211bbefc44a066aafa1760f725399215e69
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/item_updater.hpp b/item_updater.hpp
new file mode 100755
index 0000000..a854a62
--- /dev/null
+++ b/item_updater.hpp
@@ -0,0 +1,69 @@
+#pragma once
+
+#include <sdbusplus/server.hpp>
+#include "activation.hpp"
+
+namespace openpower
+{
+namespace software
+{
+namespace manager
+{
+
+/** @class ItemUpdater
+ *  @brief Manages the activation of the version items.
+ */
+class ItemUpdater
+{
+    public:
+        ItemUpdater() = delete;
+        ~ItemUpdater() = default;
+        ItemUpdater(const ItemUpdater&) = delete;
+        ItemUpdater& operator=(const ItemUpdater&) = delete;
+        ItemUpdater(ItemUpdater&&) = delete;
+        ItemUpdater& operator=(ItemUpdater&&) = delete;
+
+        /** @brief Constructs ItemUpdater
+         *
+         * @param[in] bus    - The Dbus bus object
+         */
+        ItemUpdater(sdbusplus::bus::bus& bus) :
+                    busItem(bus),
+                    versionMatch(
+                            bus,
+                           "type='signal',"
+                           "member='InterfacesAdded',"
+                           "path='/xyz/openbmc_project/software',"
+                           "interface='org.freedesktop.DBus.ObjectManager'",
+                            createActivation,
+                            this)
+        {
+        }
+
+    private:
+        /** @brief Callback function for Software.Version match.
+         *  @details Creates an Activation dbus object.
+         *
+         * @param[in]  msg       - Data associated with subscribed signal
+         * @param[in]  userData  - Pointer to this object instance
+         * @param[out] retError  - Required param
+         */
+        static int createActivation(sd_bus_message* msg,
+                                    void* userData,
+                                    sd_bus_error* retError);
+
+        /** @brief Persistent sdbusplus DBus bus connection. */
+        sdbusplus::bus::bus& busItem;
+
+        /** @brief Persistent map of Activation dbus objects and their
+          * version id */
+        std::map<uint32_t, std::unique_ptr<Activation>> activations;
+
+        /** @brief sdbusplus signal match for Software.Version */
+        sdbusplus::server::match::match versionMatch;
+};
+
+} // namespace manager
+} // namespace software
+} // namespace openpower
+