summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2018-11-26 09:50:13 -0800
committerWilliam A. Kennington III <wak@google.com>2019-04-05 15:14:52 -0700
commit4274c117dd2866ac60508f438e7427f99dee6be4 (patch)
tree5d3dbdc73b7e716aa6ade15dde0a2a5ec6e3cc6d /tools
parent8515eae7adcb9811ba271d05d82f66d48b1df082 (diff)
downloadsdbusplus-4274c117dd2866ac60508f438e7427f99dee6be4.tar.gz
sdbusplus-4274c117dd2866ac60508f438e7427f99dee6be4.zip
std::variant: Remove uses of the variant_ns
Now that we are using std::variant we should reference it directly instead of using our own namespace alias. Tested: Built and ran through unit tests. Change-Id: Ic3fd62ea74cf808b85ad7b7ffcce8c0a0bfb125d Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/sdbusplus/property.py3
-rw-r--r--tools/sdbusplus/templates/interface.mako.server.cpp.in7
-rw-r--r--tools/sdbusplus/templates/interface.mako.server.hpp9
3 files changed, 13 insertions, 6 deletions
diff --git a/tools/sdbusplus/property.py b/tools/sdbusplus/property.py
index 661bce4..e5071ff 100644
--- a/tools/sdbusplus/property.py
+++ b/tools/sdbusplus/property.py
@@ -132,8 +132,7 @@ class Property(NamedElement, Renderer):
'params': 0},
'array': {'cppName': 'std::vector', 'params': 1},
'struct': {'cppName': 'std::tuple', 'params': -1},
- 'variant': {'cppName': 'sdbusplus::message::variant',
- 'params': -1},
+ 'variant': {'cppName': 'std::variant', 'params': -1},
'dict': {'cppName': 'std::map', 'params': 2},
'enum': {'cppName': 'enum', 'params': 1, 'noparse': True}}
diff --git a/tools/sdbusplus/templates/interface.mako.server.cpp.in b/tools/sdbusplus/templates/interface.mako.server.cpp.in
index a47ff38..5af2749 100644
--- a/tools/sdbusplus/templates/interface.mako.server.cpp.in
+++ b/tools/sdbusplus/templates/interface.mako.server.cpp.in
@@ -1,7 +1,12 @@
#include <algorithm>
+#include <map>
#include <sdbusplus/sdbus.hpp>
#include <sdbusplus/server.hpp>
#include <sdbusplus/exception.hpp>
+#include <string>
+#include <tuple>
+#include <variant>
+
#include <${"/".join(interface.name.split('.') + [ 'server.hpp' ])}>
% for m in interface.methods + interface.properties + interface.signals:
${ m.cpp_prototype(loader, interface=interface, ptype='callback-cpp-includes') }
@@ -61,7 +66,7 @@ void ${classname}::setPropertyByName(const std::string& _name,
% for p in interface.properties:
if (_name == "${p.name}")
{
- auto& v = message::variant_ns::get<${p.cppTypeParam(interface.name)}>(\
+ auto& v = std::get<${p.cppTypeParam(interface.name)}>(\
val);
${p.camelCase}(v, skipSignal);
return;
diff --git a/tools/sdbusplus/templates/interface.mako.server.hpp b/tools/sdbusplus/templates/interface.mako.server.hpp
index 93cf6e7..e5b17ea 100644
--- a/tools/sdbusplus/templates/interface.mako.server.hpp
+++ b/tools/sdbusplus/templates/interface.mako.server.hpp
@@ -1,8 +1,11 @@
#pragma once
-#include <tuple>
-#include <systemd/sd-bus.h>
+#include <map>
+#include <string>
#include <sdbusplus/sdbus.hpp>
#include <sdbusplus/server.hpp>
+#include <systemd/sd-bus.h>
+#include <tuple>
+#include <variant>
% for m in interface.methods + interface.properties + interface.signals:
${ m.cpp_prototype(loader, interface=interface, ptype='callback-hpp-includes') }
% endfor
@@ -58,7 +61,7 @@ class ${classname}
% endfor
% if interface.properties:
- using PropertiesVariant = sdbusplus::message::variant<
+ using PropertiesVariant = std::variant<
${",\n ".join(setOfPropertyTypes())}>;
/** @brief Constructor to initialize the object from a map of
OpenPOWER on IntegriCloud