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>
diff --git a/CMakeLists.txt.in b/CMakeLists.txt.in
index f4f1b1e..90e653b 100644
--- a/CMakeLists.txt.in
+++ b/CMakeLists.txt.in
@@ -9,7 +9,7 @@
externalproject_add (
sdbusplus-project PREFIX ${CMAKE_BINARY_DIR}/sdbusplus-project
GIT_REPOSITORY https://github.com/openbmc/sdbusplus.git GIT_TAG
- fac43a650e59e873688d5fc6e06b5bdc88ba0546 SOURCE_DIR
+ 1a3b2c68ac0f409f501d4dedde7a0fc90e9baa90 SOURCE_DIR
${CMAKE_BINARY_DIR}/sdbusplus-src BINARY_DIR
${CMAKE_BINARY_DIR}/sdbusplus-build CONFIGURE_COMMAND "" BUILD_COMMAND cd
${CMAKE_BINARY_DIR}/sdbusplus-src && ./bootstrap.sh && ./configure
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 @@
{
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 @@
{
nlohmann::json &propertyJson =
objectJson[property.first];
- mapbox::util::apply_visitor(
+ sdbusplus::message::variant_ns::visit(
[&propertyJson](auto &&val) {
propertyJson = val;
},
@@ -860,7 +861,7 @@
if (propertyName->empty())
{
- mapbox::util::apply_visitor(
+ sdbusplus::message::variant_ns::visit(
[&response, &property](auto &&val) {
(*response)[property.first] =
val;
@@ -869,7 +870,7 @@
}
else if (property.first == *propertyName)
{
- mapbox::util::apply_visitor(
+ sdbusplus::message::variant_ns::visit(
[&response](auto &&val) {
(*response) = val;
},