summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2018-10-18 13:37:19 -0700
committerWilliam A. Kennington III <wak@google.com>2018-10-18 14:41:52 -0700
commit0a63b1c7e5dafbfae592031c89fcda61c4504a29 (patch)
tree0bc12f75d7a0788bc55fd8a9a68ab61d76ce8ef4 /include
parent6228874eaee82201e59d21d2f0b443d4b967c168 (diff)
downloadbmcweb-0a63b1c7e5dafbfae592031c89fcda61c4504a29.tar.gz
bmcweb-0a63b1c7e5dafbfae592031c89fcda61c4504a29.zip
Fixup mapbox variant references
This removes all dependencies on the mapbox specific variant api. The code is now compatible with the drop in std::variant api. Change-Id: Ie64be86ecae341def54f564eb282fb3b5356cc18 Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/dbus_monitor.hpp3
-rw-r--r--include/dbus_singleton.hpp14
-rw-r--r--include/openbmc_dbus_rest.hpp7
3 files changed, 11 insertions, 13 deletions
diff --git a/include/dbus_monitor.hpp b/include/dbus_monitor.hpp
index 5dcd5ca..44a7a94 100644
--- a/include/dbus_monitor.hpp
+++ b/include/dbus_monitor.hpp
@@ -6,6 +6,7 @@
#include <boost/container/flat_set.hpp>
#include <dbus_singleton.hpp>
#include <sdbusplus/bus/match.hpp>
+#include <sdbusplus/message/types.hpp>
namespace nlohmann
{
@@ -14,7 +15,7 @@ struct adl_serializer<sdbusplus::message::variant<Args...>>
{
static void to_json(json& j, const sdbusplus::message::variant<Args...>& v)
{
- mapbox::util::apply_visitor([&](auto&& val) { j = val; }, v);
+ sdbusplus::message::variant_ns::visit([&](auto&& val) { j = val; }, v);
}
};
} // namespace nlohmann
diff --git a/include/dbus_singleton.hpp b/include/dbus_singleton.hpp
index 2438152..9fe966f 100644
--- a/include/dbus_singleton.hpp
+++ b/include/dbus_singleton.hpp
@@ -1,20 +1,16 @@
#pragma once
#include <iostream>
#include <sdbusplus/asio/connection.hpp>
+#include <sdbusplus/message/types.hpp>
+#include <type_traits>
namespace mapbox
{
template <typename T, typename... Types>
-const T* getPtr(const mapbox::util::variant<Types...>& v)
+const T* getPtr(const sdbusplus::message::variant<Types...>& v)
{
- if (v.template is<std::remove_const_t<T>>())
- {
- return &v.template get_unchecked<std::remove_const_t<T>>();
- }
- else
- {
- return nullptr;
- }
+ namespace variant_ns = sdbusplus::message::variant_ns;
+ return variant_ns::get_if<std::remove_const_t<T>, Types...>(&v);
}
} // namespace mapbox
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index aa6c95f..1fefa40 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -23,6 +23,7 @@
#include <dbus_utility.hpp>
#include <experimental/filesystem>
#include <fstream>
+#include <sdbusplus/message/types.hpp>
namespace crow
{
@@ -126,7 +127,7 @@ void getManagedObjectsForEnumerate(const std::string &object_name,
{
nlohmann::json &propertyJson =
objectJson[property.first];
- mapbox::util::apply_visitor(
+ sdbusplus::message::variant_ns::visit(
[&propertyJson](auto &&val) {
propertyJson = val;
},
@@ -860,7 +861,7 @@ void handleGet(crow::Response &res, std::string &objectPath,
if (propertyName->empty())
{
- mapbox::util::apply_visitor(
+ sdbusplus::message::variant_ns::visit(
[&response, &property](auto &&val) {
(*response)[property.first] =
val;
@@ -869,7 +870,7 @@ void handleGet(crow::Response &res, std::string &objectPath,
}
else if (property.first == *propertyName)
{
- mapbox::util::apply_visitor(
+ sdbusplus::message::variant_ns::visit(
[&response](auto &&val) {
(*response) = val;
},
OpenPOWER on IntegriCloud