summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2018-11-12 15:54:32 -0800
committerWilliam A. Kennington III <wak@google.com>2018-11-12 16:51:49 -0800
commitefcd653d7419d6f14274f707f47fc6f9120202fe (patch)
tree8555c654745c83eb33e736485ec2485a46236118
parent0b45a3ce6d21e70453ed3d4a7dfcc2bef0865e7f (diff)
downloadphosphor-dbus-monitor-efcd653d7419d6f14274f707f47fc6f9120202fe.zip
phosphor-dbus-monitor-efcd653d7419d6f14274f707f47fc6f9120202fe.tar.gz
std::variant: Fixup .get() usage
This is just a refactor from the mapbox specific .get() interface to the common std::variant ::get<>() interface. Tested: Built and run through unit tests. Change-Id: Ic0737f632e80c9dd5b73717ec33d31f245f107db Signed-off-by: William A. Kennington III <wak@google.com>
-rw-r--r--mslverify/util.hpp2
-rw-r--r--src/propertywatchimpl.hpp2
-rw-r--r--src/resolve_errors.cpp3
-rw-r--r--src/snmp_trap.cpp12
4 files changed, 12 insertions, 7 deletions
diff --git a/mslverify/util.hpp b/mslverify/util.hpp
index e0d07ca..eefc1cd 100644
--- a/mslverify/util.hpp
+++ b/mslverify/util.hpp
@@ -125,7 +125,7 @@ static auto getProperty(::sdbusplus::bus::bus& bus, const std::string& busName,
"Get"s, interface, property);
::sdbusplus::message::variant<Property> value;
msg.read(value);
- return value.template get<Property>();
+ return ::sdbusplus::message::variant_ns::get<Property>(value);
}
/** @brief Get a property without mapper lookup. */
diff --git a/src/propertywatchimpl.hpp b/src/propertywatchimpl.hpp
index 2a44abc..94d6fd2 100644
--- a/src/propertywatchimpl.hpp
+++ b/src/propertywatchimpl.hpp
@@ -155,7 +155,7 @@ void PropertyWatchOfType<T, DBusInterfaceType>::propertiesChanged(
}
std::get<valueIndex>(std::get<storageIndex>(item->second).get()) =
- p.second.template get<T>();
+ sdbusplus::message::variant_ns::get<T>(p.second);
// Invoke callback if present.
this->callback(Context::SIGNAL);
diff --git a/src/resolve_errors.cpp b/src/resolve_errors.cpp
index caa8cf8..81452f6 100644
--- a/src/resolve_errors.cpp
+++ b/src/resolve_errors.cpp
@@ -60,7 +60,8 @@ void ResolveCallout::operator()(Context ctx)
busName, path, PROPERTY_IFACE, "Get", ASSOCIATION_IFACE,
ENDPOINTS_PROPERTY);
- const auto& logEntries = endpoints.get<EndpointList>();
+ const auto& logEntries =
+ sdbusplus::message::variant_ns::get<EndpointList>(endpoints);
// Resolve each log entry
for (const auto& logEntry : logEntries)
diff --git a/src/snmp_trap.cpp b/src/snmp_trap.cpp
index cc730b7..eb2efd3 100644
--- a/src/snmp_trap.cpp
+++ b/src/snmp_trap.cpp
@@ -33,11 +33,15 @@ void ErrorTrap::trap(sdbusplus::message::message& msg) const
return;
}
auto& propMap = it->second;
- auto errorID = propMap.at("Id").get<uint32_t>();
- auto timestamp = propMap.at("Timestamp").get<uint64_t>();
- auto sev = propMap.at("Severity").get<std::string>();
+ auto errorID =
+ sdbusplus::message::variant_ns::get<uint32_t>(propMap.at("Id"));
+ auto timestamp =
+ sdbusplus::message::variant_ns::get<uint64_t>(propMap.at("Timestamp"));
+ auto sev = sdbusplus::message::variant_ns::get<std::string>(
+ propMap.at("Severity"));
auto isev = static_cast<uint8_t>(Entry::convertLevelFromString(sev));
- auto message = propMap.at("Message").get<std::string>();
+ auto message =
+ sdbusplus::message::variant_ns::get<std::string>(propMap.at("Message"));
try
{
sendTrap<OBMCErrorNotification>(errorID, timestamp, isev, message);
OpenPOWER on IntegriCloud