summaryrefslogtreecommitdiffstats
path: root/manager.hpp
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2017-02-04 10:51:06 -0500
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2017-02-14 08:12:09 -0500
commit9bbfcb180ceba3c1af4ee03cc71e5c305c3a6b8b (patch)
tree93ae4cfed4b417117bc27f7c71c3cee505923dcc /manager.hpp
parent0237971c1e8cd102e2035f92f8e794b8e6711b2d (diff)
downloadphosphor-inventory-manager-9bbfcb180ceba3c1af4ee03cc71e5c305c3a6b8b.tar.gz
phosphor-inventory-manager-9bbfcb180ceba3c1af4ee03cc71e5c305c3a6b8b.zip
Set properties when constructing interfaces.
Make use of new sdbusplus support for passing a map of properties and their values to the interface constructor. Change-Id: Ib0dd406fd80c89acb723e3a376af26ba57b53d27 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'manager.hpp')
-rw-r--r--manager.hpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/manager.hpp b/manager.hpp
index 5e0930b..806a9a4 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -39,8 +39,20 @@ struct MakeInterface
const char* path,
const Interface& props)
{
- // TODO: pass props to import constructor...
- return any_ns::any(std::make_shared<T>(bus, path));
+ using PropertiesVariant = typename T::PropertiesVariant;
+ using InterfaceVariant =
+ std::map<std::string, PropertiesVariant>;
+
+ InterfaceVariant v;
+
+ for (const auto& p : props)
+ {
+ v.emplace(
+ p.first,
+ convertVariant<PropertiesVariant>(p.second));
+ }
+
+ return any_ns::any(std::make_shared<T>(bus, path, v));
}
};
OpenPOWER on IntegriCloud