sensor:monitor: Use a single PowerState object
Now that both monitor classes need to know about power state, change
them to keep a shared_ptr to a PowerState object and then pass the
object into their constructors.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Ia83217e8af51204bbb3fc6e8e3f2eac5912b5913
diff --git a/sensor-monitor/threshold_alarm_logger.hpp b/sensor-monitor/threshold_alarm_logger.hpp
index 3e611d8..3380e49 100644
--- a/sensor-monitor/threshold_alarm_logger.hpp
+++ b/sensor-monitor/threshold_alarm_logger.hpp
@@ -64,8 +64,10 @@
*
* @param[in] bus - The sdbusplus bus object
* @param[in] event - The sdeventplus event object
+ * @param[in] powerState - The PowerState object
*/
- ThresholdAlarmLogger(sdbusplus::bus::bus& bus, sdeventplus::Event& event);
+ ThresholdAlarmLogger(sdbusplus::bus::bus& bus, sdeventplus::Event& event,
+ std::shared_ptr<phosphor::fan::PowerState> powerState);
private:
/**
@@ -167,7 +169,7 @@
/**
* @brief The PowerState object to track power state changes.
*/
- std::unique_ptr<phosphor::fan::PowerState> _powerState;
+ std::shared_ptr<phosphor::fan::PowerState> _powerState;
/**
* @brief The Warning interface match object