diff options
author | William A. Kennington III <wak@google.com> | 2018-10-18 19:19:51 -0700 |
---|---|---|
committer | William A. Kennington III <wak@google.com> | 2018-10-18 19:19:51 -0700 |
commit | 4cbdfef205ba4011018a3a287dd238e00509a757 (patch) | |
tree | 9c6ea5017b5749f91381ddd1ad5ccaddb6b70398 | |
parent | 0956017412c84ac2a264d44dbb3f201d2f6c96f1 (diff) | |
download | phosphor-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.cpp | 12 | ||||
-rw-r--r-- | mainloop.hpp | 8 | ||||
-rw-r--r-- | sensor.cpp | 4 | ||||
-rw-r--r-- | thresholds.hpp | 4 | ||||
-rw-r--r-- | types.hpp | 4 |
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); }; @@ -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); @@ -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>; |