diff options
Diffstat (limited to 'monitor/trust_group.hpp')
-rw-r--r-- | monitor/trust_group.hpp | 26 |
1 files changed, 15 insertions, 11 deletions
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: |