Stop using mapbox directly
This is going to be removed from sdbusplus
Change-Id: I912f560fac7d41e13d3754df9363b95cedac78f8
Signed-off-by: Yoo, Jae Hyun <jae.hyun.yoo@intel.com>
diff --git a/sensors/src/ADCSensorMain.cpp b/sensors/src/ADCSensorMain.cpp
index 845b976..47edd5c 100644
--- a/sensors/src/ADCSensorMain.cpp
+++ b/sensors/src/ADCSensorMain.cpp
@@ -29,6 +29,7 @@
static constexpr bool DEBUG = false;
namespace fs = std::experimental::filesystem;
+namespace variant_ns = sdbusplus::message::variant_ns;
static constexpr std::array<const char*, 1> SENSOR_TYPES = {
"xyz.openbmc_project.Configuration.ADC"};
static std::regex INPUT_REGEX(R"(in(\d+)_input)");
@@ -177,8 +178,8 @@
float scaleFactor = 1.0;
if (findScaleFactor != baseConfiguration->second.end())
{
- scaleFactor = mapbox::util::apply_visitor(VariantToFloatVisitor(),
- findScaleFactor->second);
+ scaleFactor = variant_ns::visit(VariantToFloatVisitor(),
+ findScaleFactor->second);
}
sensors[sensorName] = std::make_unique<ADCSensor>(
path.string(), objectServer, dbusConnection, io, sensorName,
diff --git a/sensors/src/CPUSensorMain.cpp b/sensors/src/CPUSensorMain.cpp
index 6318dd8..0edbc65 100644
--- a/sensors/src/CPUSensorMain.cpp
+++ b/sensors/src/CPUSensorMain.cpp
@@ -64,6 +64,7 @@
static constexpr const unsigned int RANK_NUM_MAX = 8;
namespace fs = std::experimental::filesystem;
+namespace variant_ns = sdbusplus::message::variant_ns;
static constexpr const char* CONFIG_PREFIX =
"xyz.openbmc_project.Configuration.";
static constexpr std::array<const char*, 3> SENSOR_TYPES = {
@@ -181,8 +182,7 @@
std::cerr << "could not determine CPU ID for " << oemName << "\n";
continue;
}
- int cpuId = mapbox::util::apply_visitor(VariantToIntVisitor(),
- findCpuId->second);
+ int cpuId = variant_ns::visit(VariantToIntVisitor(), findCpuId->second);
auto directory = oemNamePath.parent_path().parent_path();
std::vector<fs::path> inputPaths;
@@ -420,15 +420,15 @@
{
continue;
}
- int addr = mapbox::util::apply_visitor(VariantToIntVisitor(),
- findAddress->second);
+ int addr = variant_ns::visit(VariantToIntVisitor(),
+ findAddress->second);
auto findName = config.second.find("Name");
if (findName == config.second.end())
{
continue;
}
- std::string nameRaw = mapbox::util::apply_visitor(
+ std::string nameRaw = variant_ns::visit(
VariantToStringVisitor(), findName->second);
std::string name =
std::regex_replace(nameRaw, ILLEGAL_NAME_REGEX, "_");
diff --git a/sensors/src/FanMain.cpp b/sensors/src/FanMain.cpp
index 6818692..b562e05 100644
--- a/sensors/src/FanMain.cpp
+++ b/sensors/src/FanMain.cpp
@@ -31,6 +31,7 @@
static constexpr bool DEBUG = false;
namespace fs = std::experimental::filesystem;
+namespace variant_ns = sdbusplus::message::variant_ns;
static constexpr std::array<const char*, 1> SENSOR_TYPES = {
"xyz.openbmc_project.Configuration.AspeedFan"};
static std::regex INPUT_REGEX(R"(fan(\d+)_input)");
@@ -117,8 +118,8 @@
{
continue;
}
- uint16_t pwmIndex = mapbox::util::apply_visitor(
- VariantToUnsignedIntVisitor(), findPwmIndex->second);
+ uint16_t pwmIndex = variant_ns::visit(VariantToUnsignedIntVisitor(),
+ findPwmIndex->second);
auto oemNamePath = directory.string() + R"(/of_node/oemname)" +
std::to_string(pwmIndex);
@@ -144,7 +145,7 @@
std::cerr << baseConfiguration->first << " missing index\n";
continue;
}
- unsigned int configIndex = mapbox::util::apply_visitor(
+ unsigned int configIndex = variant_ns::visit(
VariantToUnsignedIntVisitor(), findIndex->second);
if (configIndex != index)
@@ -157,7 +158,7 @@
{
continue;
}
- std::string connectorName = mapbox::util::apply_visitor(
+ std::string connectorName = variant_ns::visit(
VariantToStringVisitor(), findConnectorName->second);
boost::replace_all(connectorName, " ", "_");
if (connectorName == oemName)
diff --git a/sensors/src/Thresholds.cpp b/sensors/src/Thresholds.cpp
index c40d35d..32244d7 100644
--- a/sensors/src/Thresholds.cpp
+++ b/sensors/src/Thresholds.cpp
@@ -9,6 +9,7 @@
static constexpr bool DEBUG = false;
constexpr size_t MAX_THRESHOLDS = 4;
+namespace variant_ns = sdbusplus::message::variant_ns;
namespace thresholds
{
unsigned int toBusValue(const Level &level)
@@ -65,8 +66,8 @@
auto labelFind = item.second.find("Label");
if (labelFind == item.second.end())
continue;
- if (mapbox::util::apply_visitor(VariantToStringVisitor(),
- labelFind->second) != *matchLabel)
+ if (variant_ns::visit(VariantToStringVisitor(),
+ labelFind->second) != *matchLabel)
continue;
}
auto directionFind = item.second.find("Direction");
@@ -81,8 +82,8 @@
}
Level level;
Direction direction;
- if (mapbox::util::apply_visitor(VariantToUnsignedIntVisitor(),
- severityFind->second) == 0)
+ if (variant_ns::visit(VariantToUnsignedIntVisitor(),
+ severityFind->second) == 0)
{
level = Level::WARNING;
}
@@ -90,8 +91,8 @@
{
level = Level::CRITICAL;
}
- if (mapbox::util::apply_visitor(VariantToStringVisitor(),
- directionFind->second) == "less than")
+ if (variant_ns::visit(VariantToStringVisitor(),
+ directionFind->second) == "less than")
{
direction = Direction::LOW;
}
@@ -99,8 +100,8 @@
{
direction = Direction::HIGH;
}
- float val = mapbox::util::apply_visitor(VariantToFloatVisitor(),
- valueFind->second);
+ float val =
+ variant_ns::visit(VariantToFloatVisitor(), valueFind->second);
thresholdVector.emplace_back(level, direction, val);
}
@@ -134,11 +135,11 @@
std::cerr << "Malformed threshold in configuration\n";
return;
}
- unsigned int level = mapbox::util::apply_visitor(
+ unsigned int level = variant_ns::visit(
VariantToUnsignedIntVisitor(), severityFind->second);
- std::string dir = mapbox::util::apply_visitor(
- VariantToStringVisitor(), directionFind->second);
+ std::string dir = variant_ns::visit(VariantToStringVisitor(),
+ directionFind->second);
if ((toBusValue(threshold.level) != level) ||
(toBusValue(threshold.direction) != dir))
{