summaryrefslogtreecommitdiffstats
path: root/sensorhandler.cpp
diff options
context:
space:
mode:
authorJames Feist <james.feist@linux.intel.com>2018-07-31 11:44:09 -0700
committerTom Joseph <tomjoseph@in.ibm.com>2018-08-09 19:37:07 +0000
commit1e12112baf56f9a8ec6dbf7fb409c84f35fff1e8 (patch)
tree6574eaa7230f377cfbc075d9cbaefc6e4341bc56 /sensorhandler.cpp
parentbed2699f47c34aa547f85e8d66d50df21be12a0a (diff)
downloadphosphor-host-ipmid-1e12112baf56f9a8ec6dbf7fb409c84f35fff1e8.tar.gz
phosphor-host-ipmid-1e12112baf56f9a8ec6dbf7fb409c84f35fff1e8.zip
Use visitor instead of pulling values directly
Sensor thresholds pull out an int64_t and immediately assign it to a double. Use a visitor instead to avoid the intermediate and add flexibility / saftey to type readings. Tested-By: Verifed sensor list still worked. Change-Id: If49bf54ec1c0636b3549d433b86ecdbd1ea99b0d Signed-off-by: James Feist <james.feist@linux.intel.com>
Diffstat (limited to 'sensorhandler.cpp')
-rw-r--r--sensorhandler.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/sensorhandler.cpp b/sensorhandler.cpp
index ee62e17..609fdfd 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -619,8 +619,10 @@ void getSensorThresholds(uint8_t sensorNum,
info.sensorPath,
warningThreshIntf);
- double warnLow = warnThresholds["WarningLow"].get<int64_t>();
- double warnHigh = warnThresholds["WarningHigh"].get<int64_t>();
+ double warnLow = mapbox::util::apply_visitor(ipmi::VariantToDoubleVisitor(),
+ warnThresholds["WarningLow"]);
+ double warnHigh = mapbox::util::apply_visitor(
+ ipmi::VariantToDoubleVisitor(), warnThresholds["WarningHigh"]);
if (warnLow != 0)
{
@@ -644,8 +646,10 @@ void getSensorThresholds(uint8_t sensorNum,
service,
info.sensorPath,
criticalThreshIntf);
- double critLow = critThresholds["CriticalLow"].get<int64_t>();
- double critHigh = critThresholds["CriticalHigh"].get<int64_t>();
+ double critLow = mapbox::util::apply_visitor(ipmi::VariantToDoubleVisitor(),
+ critThresholds["CriticalLow"]);
+ double critHigh = mapbox::util::apply_visitor(
+ ipmi::VariantToDoubleVisitor(), critThresholds["CriticalHigh"]);
if (critLow != 0)
{
OpenPOWER on IntegriCloud