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/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())