diff options
author | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-02-04 10:51:06 -0500 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-02-14 08:12:09 -0500 |
commit | 9bbfcb180ceba3c1af4ee03cc71e5c305c3a6b8b (patch) | |
tree | 93ae4cfed4b417117bc27f7c71c3cee505923dcc /manager.hpp | |
parent | 0237971c1e8cd102e2035f92f8e794b8e6711b2d (diff) | |
download | phosphor-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.hpp | 16 |
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)); } }; |