Maker factory refactoring

Prepare for the addition of new iface -> class op adapters.

Get ready to pass the interface properties to the sdbusplus
server binding constructor, once that method is available.

Change-Id: I002cc187ac3d8d8a7fd02cc820f831e345e49a61
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/generated.mako.cpp b/generated.mako.cpp
index 12d783b..562465d 100644
--- a/generated.mako.cpp
+++ b/generated.mako.cpp
@@ -20,9 +20,11 @@
 % for i in interfaces:
     {
         "${str(i)}",
-        details::MakeInterface<
-            details::ServerObject<
-                ${i.namespace()}>>::make,
+        std::make_tuple(
+            details::MakeInterface<
+                details::ServerObject<
+                    ${i.namespace()}>>::make
+        )
     },
 % endfor
 };
diff --git a/manager.cpp b/manager.cpp
index 5562b95..83ca75f 100644
--- a/manager.cpp
+++ b/manager.cpp
@@ -154,14 +154,20 @@
         {
             // Defer sending any signals until the last interface.
             auto deferSignals = --i != 0;
-            auto maker = _makers.find(x.first.c_str());
+            auto pMakers = _makers.find(x.first.c_str());
 
-            if (maker == _makers.end())
+            if (pMakers == _makers.end())
                 throw std::runtime_error(
                     "Unimplemented interface: " + x.first);
 
-            ref.emplace(x.first,
-                        (maker->second)(_bus, path.str.c_str(), deferSignals));
+            auto& maker = std::get<MakerType>(pMakers->second);
+
+            auto& props = x.second;
+            ref.emplace(x.first, maker(
+                            _bus,
+                            path.str.c_str(),
+                            props,
+                            deferSignals));
         }
 
         if (!ref.empty())
diff --git a/manager.hpp b/manager.hpp
index 33980b9..7a01bee 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -36,16 +36,20 @@
 template <typename T>
 struct MakeInterface
 {
-    static auto make(sdbusplus::bus::bus& bus, const char* path, bool deferSignals)
+    static std::unique_ptr<details::holder::Base> make(
+        sdbusplus::bus::bus& bus,
+        const char* path,
+        const Interface& props,
+        bool deferSignals)
     {
+        // TODO: pass props to import constructor...
         using HolderType = holder::Holder<std::unique_ptr<T>>;
-        return static_cast<std::unique_ptr<holder::Base>>(
-                   HolderType::template make_unique<HolderType>(
-                       std::forward<std::unique_ptr<T>>(
-                           std::make_unique<T>(
-                               std::forward<decltype(bus)>(bus),
-                               std::forward<decltype(path)>(path),
-                               std::forward<decltype(deferSignals)>(deferSignals)))));
+        return HolderType::template make_unique<HolderType>(
+            std::forward<std::unique_ptr<T>>(
+                std::make_unique<T>(
+                    std::forward<decltype(bus)>(bus),
+                    std::forward<decltype(path)>(path),
+                    std::forward<decltype(deferSignals)>(deferSignals))));
     }
 };
 } // namespace details
@@ -139,9 +143,12 @@
         using InterfaceComposite = std::map<std::string, HolderPtr>;
         using ObjectReferences = std::map<std::string, InterfaceComposite>;
         using Events = std::vector<EventInfo>;
-        using MakerType = HolderPtr(*)(
-                              sdbusplus::bus::bus&, const char*, bool);
-        using Makers = std::map<std::string, MakerType>;
+
+        // The int instantiation is safe since the signature of these
+        // functions don't change from one instantiation to the next.
+        using MakerType = std::add_pointer_t <
+                          decltype(details::MakeInterface<int>::make) >;
+        using Makers = std::map<std::string, std::tuple<MakerType>>;
 
         /** @brief Provides weak references to interface holders.
          *