summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--monitor/nonzero_speed_trust.hpp2
-rw-r--r--monitor/trust_group.hpp26
2 files changed, 16 insertions, 12 deletions
diff --git a/monitor/nonzero_speed_trust.hpp b/monitor/nonzero_speed_trust.hpp
index e1f787f..7e6a85a 100644
--- a/monitor/nonzero_speed_trust.hpp
+++ b/monitor/nonzero_speed_trust.hpp
@@ -54,7 +54,7 @@ class NonzeroSpeed : public Group
_sensors.end(),
[](const auto& s)
{
- return std::get<0>(s)->getInput() != 0;
+ return s.sensor->getInput() != 0;
});
}
};
diff --git a/monitor/trust_group.hpp b/monitor/trust_group.hpp
index 7f28f6c..a41520a 100644
--- a/monitor/trust_group.hpp
+++ b/monitor/trust_group.hpp
@@ -14,6 +14,12 @@ constexpr auto inTrust = 1;
using GroupDefinition = std::tuple<std::string,
bool>;
+struct GroupSensor
+{
+ std::shared_ptr<monitor::TachSensor> sensor;
+ bool inTrust;
+};
+
/**
* @class Group
*
@@ -75,8 +81,7 @@ class Group
if (found != _names.end())
{
- auto gs = std::make_tuple(sensor, std::get<inTrust>(*found));
- _sensors.push_back(gs);
+ _sensors.push_back({sensor, std::get<inTrust>(*found)});
}
}
@@ -95,7 +100,7 @@ class Group
_sensors.end(),
[&sensor](const auto& s)
{
- return sensor.name() == std::get<0>(s)->name();
+ return sensor.name() == s.sensor->name();
}) != _sensors.end());
}
@@ -113,7 +118,7 @@ class Group
_sensors.end(),
[](const auto& s)
{
- std::get<0>(s)->stopTimer();
+ s.sensor->stopTimer();
});
}
@@ -132,11 +137,12 @@ class Group
{
//If a sensor isn't functional, then its timer
//already expired so don't bother starting it again
- if (std::get<0>(s)->functional() &&
- static_cast<uint64_t>(std::get<0>(s)->getInput()) !=
- std::get<0>(s)->getTarget())
+ if (s.sensor->functional() &&
+ static_cast<uint64_t>(
+ s.sensor->getInput()) !=
+ s.sensor->getTarget())
{
- std::get<0>(s)->startTimer();
+ s.sensor->startTimer();
}
});
}
@@ -200,9 +206,7 @@ class Group
*
* Added by registerSensor().
*/
- std::vector<std::tuple<
- std::shared_ptr<monitor::TachSensor>,
- bool>> _sensors;
+ std::vector<GroupSensor> _sensors;
private:
OpenPOWER on IntegriCloud