inventory: implement serialization

Use Cereal to serialize and persist inventory items to the filesystem.
Serialize inventory objects as and when they're created/updated via the
notify() API.

Create a template API to perform serialization on the sdbusplus
inventory interface type.

An inventory item path /foo/bar/baz implementing interfaces iface1 and
iface2 would be stored in paths /foo/bar/baz/iface1 and
/foo/bar/baz/iface2.

Change-Id: I9a175185eac1740d6f2ca86a3ee13457edfc8ea9
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/manager.hpp b/manager.hpp
index 4f146cb..a94d5ea 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -9,6 +9,7 @@
 #include "events.hpp"
 #include "functor.hpp"
 #include "types.hpp"
+#include "serialize.hpp"
 
 namespace phosphor
 {
@@ -85,6 +86,14 @@
                 p.first, convertVariant<PropertiesVariantType<T>>(p.second));
         }
     }
+
+    static void serialize(const std::string& path, const std::string& iface,
+                          const any_ns::any& holder)
+    {
+        const auto& object =
+            *any_ns::any_cast<const std::shared_ptr<T> &>(holder);
+        cereal::serialize(path, iface, object);
+    }
 };
 
 /** @class Manager
@@ -190,7 +199,10 @@
                           decltype(MakeInterface<int>::make) >;
         using AssignerType = std::add_pointer_t <
                              decltype(MakeInterface<int>::assign) >;
-        using Makers = std::map<std::string, std::tuple<MakerType, AssignerType>>;
+        using SerializerType = std::add_pointer_t <
+                               decltype(MakeInterface<int>::serialize) >;
+        using Makers = std::map<std::string,
+                           std::tuple<MakerType, AssignerType, SerializerType>>;
 
         /** @brief Provides weak references to interface holders.
          *