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>
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 @@
'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 @@
% 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 @@
% 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