summaryrefslogtreecommitdiffstats
path: root/control/zone.hpp
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2018-11-05 11:13:25 -0600
committerMatthew Barth <msbarth@linux.ibm.com>2018-11-06 15:24:41 +0000
commit33bfe76177df0b91a33b75bc33759977ba55ff5c (patch)
treef82af9311b94a54a203196aaf2d938bf40e3a0d8 /control/zone.hpp
parent22c36ab6b4c1b42a12958d6c88452d039a28b6f8 (diff)
downloadphosphor-fan-presence-33bfe76177df0b91a33b75bc33759977ba55ff5c.tar.gz
phosphor-fan-presence-33bfe76177df0b91a33b75bc33759977ba55ff5c.zip
Remove all signals when an event is removed
Each event could have multiple signals associated and when the event is removed, all of those signals should also be removed. This ensures no dangling signals remain after an event is removed from be processed by fan control Tested: The total number of signals subscribed are reduced by the same number of signals of a removed event Change-Id: I651f70dbe6aed9c7eef06aff4eac9eae7ad89d77 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Diffstat (limited to 'control/zone.hpp')
-rw-r--r--control/zone.hpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/control/zone.hpp b/control/zone.hpp
index 002feb4..11cfc65 100644
--- a/control/zone.hpp
+++ b/control/zone.hpp
@@ -343,6 +343,46 @@ class Zone
}
/**
+ * @brief Get the list of signal events
+ *
+ * @return - List of signal events
+ */
+ inline auto& getSignalEvents()
+ {
+ return _signalEvents;
+ }
+
+ /**
+ * @brief Find the first instance of a signal event
+ *
+ * @param[in] signal - Event signal to find
+ * @param[in] eGroup - Group associated with the signal
+ * @param[in] eActions - List of actions associated with the signal
+ *
+ * @return - Iterator to the stored signal event
+ */
+ std::vector<SignalEvent>::iterator findSignal(
+ const Signal& signal,
+ const Group& eGroup,
+ const std::vector<Action>& eActions);
+
+ /**
+ * @brief Remove the given signal event
+ *
+ * @param[in] seIter - Iterator pointing to the signal event to remove
+ */
+ inline void removeSignal(std::vector<SignalEvent>::iterator& seIter)
+ {
+ assert(seIter != std::end(_signalEvents));
+ std::get<signalEventDataPos>(*seIter).reset();
+ if (std::get<signalMatchPos>(*seIter) != nullptr)
+ {
+ std::get<signalMatchPos>(*seIter).reset();
+ }
+ _signalEvents.erase(seIter);
+ }
+
+ /**
* @brief Get the list of timer events
*
* @return - List of timer events
OpenPOWER on IntegriCloud