monitor: Clang format updates
Used `format-code.sh` build script to make changes to conform to clang
format.
Tested: Compiled
Change-Id: Ieead1449cfd4b61333a135740dce03789218f92b
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/monitor/trust_manager.hpp b/monitor/trust_manager.hpp
index 031d890..1925003 100644
--- a/monitor/trust_manager.hpp
+++ b/monitor/trust_manager.hpp
@@ -1,11 +1,12 @@
#pragma once
-#include <memory>
-#include <vector>
#include "tach_sensor.hpp"
#include "trust_group.hpp"
#include "types.hpp"
+#include <memory>
+#include <vector>
+
namespace phosphor
{
namespace fan
@@ -27,120 +28,112 @@
*/
class Manager
{
- public:
+ public:
+ Manager() = delete;
+ Manager(const Manager&) = delete;
+ Manager& operator=(const Manager&) = delete;
+ Manager(Manager&&) = default;
+ Manager& operator=(Manager&&) = default;
+ ~Manager() = default;
- Manager() = delete;
- Manager(const Manager&) = delete;
- Manager& operator=(const Manager&) = delete;
- Manager(Manager&&) = default;
- Manager& operator=(Manager&&) = default;
- ~Manager() = default;
-
- /**
- * Constructor
- *
- * @param[in] functions - trust group creation function vector
- */
- explicit Manager(const std::vector<monitor::CreateGroupFunction>& functions)
+ /**
+ * Constructor
+ *
+ * @param[in] functions - trust group creation function vector
+ */
+ explicit Manager(const std::vector<monitor::CreateGroupFunction>& functions)
+ {
+ for (auto& create : functions)
{
- for (auto& create : functions)
- {
- groups.emplace_back(create());
- }
+ groups.emplace_back(create());
}
+ }
- /**
- * Says if trust groups have been created and
- * need to be checked.
- *
- * @return bool - If there are any trust groups
- */
- inline bool active() const
+ /**
+ * Says if trust groups have been created and
+ * need to be checked.
+ *
+ * @return bool - If there are any trust groups
+ */
+ inline bool active() const
+ {
+ return !groups.empty();
+ }
+
+ /**
+ * Checks if a sensor value can be trusted
+ *
+ * Checks if the sensor is trusted in each group
+ * it belongs to. Only considered trusted if it is
+ * trusted in all groups it belongs to.
+ *
+ * While checking group trust, the code will also check
+ * if the trust status has just changed. If the status
+ * just changed to false, it will stop the tach error
+ * timers for that group so these untrusted sensors won't
+ * cause errors. If changed to true, it will start those timers
+ * back up again.
+ *
+ * Note this means groups should be designed such that
+ * in the same call to this function a sensor shouldn't
+ * make one group change to trusted and another to untrusted.
+ *
+ * @param[in] sensor - the sensor to check
+ *
+ * @return bool - if sensor is trusted in all groups or not
+ */
+ bool checkTrust(const monitor::TachSensor& sensor)
+ {
+ auto trusted = true;
+
+ for (auto& group : groups)
{
- return !groups.empty();
- }
-
- /**
- * Checks if a sensor value can be trusted
- *
- * Checks if the sensor is trusted in each group
- * it belongs to. Only considered trusted if it is
- * trusted in all groups it belongs to.
- *
- * While checking group trust, the code will also check
- * if the trust status has just changed. If the status
- * just changed to false, it will stop the tach error
- * timers for that group so these untrusted sensors won't
- * cause errors. If changed to true, it will start those timers
- * back up again.
- *
- * Note this means groups should be designed such that
- * in the same call to this function a sensor shouldn't
- * make one group change to trusted and another to untrusted.
- *
- * @param[in] sensor - the sensor to check
- *
- * @return bool - if sensor is trusted in all groups or not
- */
- bool checkTrust(
- const monitor::TachSensor& sensor)
- {
- auto trusted = true;
-
- for (auto& group : groups)
+ if (group->inGroup(sensor))
{
- if (group->inGroup(sensor))
+ bool trust, changed;
+ std::tie(trust, changed) = group->checkTrust(sensor);
+
+ if (!trust)
{
- bool trust, changed;
- std::tie(trust, changed) = group->checkTrust(sensor);
+ trusted = false;
- if (!trust)
+ if (changed)
{
- trusted = false;
-
- if (changed)
- {
- group->stopTimers();
- }
+ group->stopTimers();
}
- else
+ }
+ else
+ {
+ if (changed)
{
- if (changed)
- {
- group->startTimers();
- }
+ group->startTimers();
}
}
}
-
- return trusted;
}
- /**
- * Registers a sensor with any trust groups that are interested
- *
- * @param[in] sensor - the sensor to register
- */
- void registerSensor(
- std::shared_ptr<monitor::TachSensor>& sensor)
- {
- std::for_each(
- groups.begin(),
- groups.end(),
- [&sensor](auto& group)
- {
- group->registerSensor(sensor);
- });
- }
+ return trusted;
+ }
- private:
+ /**
+ * Registers a sensor with any trust groups that are interested
+ *
+ * @param[in] sensor - the sensor to register
+ */
+ void registerSensor(std::shared_ptr<monitor::TachSensor>& sensor)
+ {
+ std::for_each(groups.begin(), groups.end(), [&sensor](auto& group) {
+ group->registerSensor(sensor);
+ });
+ }
- /**
- * The list of sensor trust groups
- */
- std::vector<std::unique_ptr<Group>> groups;
+ private:
+ /**
+ * The list of sensor trust groups
+ */
+ std::vector<std::unique_ptr<Group>> groups;
};
-}
-}
-}
+} // namespace trust
+} // namespace fan
+} // namespace phosphor