summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2018-10-18 19:19:51 -0700
committerWilliam A. Kennington III <wak@google.com>2018-10-18 19:19:51 -0700
commit4cbdfef205ba4011018a3a287dd238e00509a757 (patch)
tree9c6ea5017b5749f91381ddd1ad5ccaddb6b70398
parent0956017412c84ac2a264d44dbb3f201d2f6c96f1 (diff)
downloadphosphor-hwmon-4cbdfef205ba4011018a3a287dd238e00509a757.tar.gz
phosphor-hwmon-4cbdfef205ba4011018a3a287dd238e00509a757.zip
Remove old experimental includes
We are now using c++17 so we no longer need experimental optional and any. We can use the standard any and optional now. Change-Id: I88fcb4258c69ac5ad9766e2c65463c52a3b7f05f Signed-off-by: William A. Kennington III <wak@google.com>
-rw-r--r--mainloop.cpp12
-rw-r--r--mainloop.hpp8
-rw-r--r--sensor.cpp4
-rw-r--r--thresholds.hpp4
-rw-r--r--types.hpp4
5 files changed, 15 insertions, 17 deletions
diff --git a/mainloop.cpp b/mainloop.cpp
index 5fa6404..7435ef3 100644
--- a/mainloop.cpp
+++ b/mainloop.cpp
@@ -131,7 +131,7 @@ SensorIdentifiers
* are created and the InterfacesAdded signal is emitted. The object's state
* data is then returned for sensor state monitoring within the main loop.
*/
-optional_ns::optional<ObjectStateData>
+std::optional<ObjectStateData>
MainLoop::getObject(SensorSet::container_t::const_reference sensor)
{
auto properties = getIdentifiers(sensor);
@@ -377,8 +377,9 @@ void MainLoop::read()
auto fault = ioAccess.read(
i.first.first, i.first.second, hwmon::entry::fault,
hwmonio::retries, hwmonio::delay);
- auto statusIface = std::experimental::any_cast<
- std::shared_ptr<StatusObject>>(it->second);
+ auto statusIface =
+ std::any_cast<std::shared_ptr<StatusObject>>(
+ it->second);
if (!statusIface->functional((fault == 0) ? true : false))
{
continue;
@@ -408,8 +409,9 @@ void MainLoop::read()
switch (iface.first)
{
case InterfaceType::VALUE:
- valueIface = std::experimental::any_cast<
- std::shared_ptr<ValueObject>>(iface.second);
+ valueIface =
+ std::any_cast<std::shared_ptr<ValueObject>>(
+ iface.second);
valueIface->value(value);
break;
case InterfaceType::WARN:
diff --git a/mainloop.hpp b/mainloop.hpp
index 77419e5..9c50c78 100644
--- a/mainloop.hpp
+++ b/mainloop.hpp
@@ -8,9 +8,9 @@
#include "timer.hpp"
#include "types.hpp"
-#include <experimental/any>
-#include <experimental/optional>
+#include <any>
#include <memory>
+#include <optional>
#include <sdbusplus/server.hpp>
#include <string>
#include <vector>
@@ -21,8 +21,6 @@ static constexpr auto sensorID = 0;
static constexpr auto sensorLabel = 1;
using SensorIdentifiers = std::tuple<std::string, std::string>;
-namespace optional_ns = std::experimental;
-
/** @class MainLoop
* @brief hwmon-readd main application loop.
*/
@@ -135,6 +133,6 @@ class MainLoop
* @return - Optional
* Object state data on success, nothing on failure
*/
- optional_ns::optional<ObjectStateData>
+ std::optional<ObjectStateData>
getObject(SensorSet::container_t::const_reference sensor);
};
diff --git a/sensor.cpp b/sensor.cpp
index 21f3d87..0a0971f 100644
--- a/sensor.cpp
+++ b/sensor.cpp
@@ -118,9 +118,7 @@ std::shared_ptr<ValueObject> Sensor::addValue(const RetryIO& retryIO,
auto it = obj.find(InterfaceType::STATUS);
if (it != obj.end())
{
- statusIface =
- std::experimental::any_cast<std::shared_ptr<StatusObject>>(
- it->second);
+ statusIface = std::any_cast<std::shared_ptr<StatusObject>>(it->second);
}
// If there's no fault file or the sensor has a fault file and
diff --git a/thresholds.hpp b/thresholds.hpp
index 8b5329c..7e8dbf5 100644
--- a/thresholds.hpp
+++ b/thresholds.hpp
@@ -57,9 +57,9 @@ struct Thresholds<CriticalObject>
* @param[in] value - The sensor reading to compare to thresholds.
*/
template <typename T>
-void checkThresholds(std::experimental::any& iface, int64_t value)
+void checkThresholds(std::any& iface, int64_t value)
{
- auto realIface = std::experimental::any_cast<std::shared_ptr<T>>(iface);
+ auto realIface = std::any_cast<std::shared_ptr<T>>(iface);
auto lo = (*realIface.*Thresholds<T>::getLo)();
auto hi = (*realIface.*Thresholds<T>::getHi)();
(*realIface.*Thresholds<T>::alarmLo)(value <= lo);
diff --git a/types.hpp b/types.hpp
index a33869c..d5a096b 100644
--- a/types.hpp
+++ b/types.hpp
@@ -2,9 +2,9 @@
#include "interface.hpp"
-#include <experimental/any>
+#include <any>
-using Object = std::map<InterfaceType, std::experimental::any>;
+using Object = std::map<InterfaceType, std::any>;
using ObjectInfo = std::tuple<sdbusplus::bus::bus*, std::string, Object>;
using RetryIO = std::tuple<size_t, std::chrono::milliseconds>;
using ObjectStateData = std::pair<std::string, ObjectInfo>;
OpenPOWER on IntegriCloud