presence: Clang format updates
Used `format-code.sh` build script to make changes to conform to clang
format.
Tested: Compiled
Change-Id: I2fc795938e85a752ee56b54212d389c2ff296828
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/presence/json_config.hpp b/presence/json_config.hpp
index 7a3f7b8..6045e90 100644
--- a/presence/json_config.hpp
+++ b/presence/json_config.hpp
@@ -1,16 +1,17 @@
#pragma once
-#include <string>
-#include <vector>
-#include <memory>
-#include <nlohmann/json.hpp>
-#include <filesystem>
-#include <sdeventplus/source/signal.hpp>
-#include <sdbusplus/bus.hpp>
-
-#include "rpolicy.hpp"
#include "fan.hpp"
#include "psensor.hpp"
+#include "rpolicy.hpp"
+
+#include <nlohmann/json.hpp>
+#include <sdbusplus/bus.hpp>
+#include <sdeventplus/source/signal.hpp>
+
+#include <filesystem>
+#include <memory>
+#include <string>
+#include <vector>
namespace phosphor
{
@@ -35,105 +36,103 @@
using fanPolicy = std::tuple<Fan, std::vector<std::unique_ptr<PresenceSensor>>>;
// Presence method handler function
-using methodHandler = std::function<
- std::unique_ptr<PresenceSensor>(size_t, const json&)>;
+using methodHandler =
+ std::function<std::unique_ptr<PresenceSensor>(size_t, const json&)>;
// Presence redundancy policy handler function
-using rpolicyHandler = std::function<
- std::unique_ptr<RedundancyPolicy>(const fanPolicy&)>;
+using rpolicyHandler =
+ std::function<std::unique_ptr<RedundancyPolicy>(const fanPolicy&)>;
class JsonConfig
{
- public:
+ public:
+ JsonConfig() = delete;
+ JsonConfig(const JsonConfig&) = delete;
+ JsonConfig(JsonConfig&&) = delete;
+ JsonConfig& operator=(const JsonConfig&) = delete;
+ JsonConfig& operator=(JsonConfig&&) = delete;
+ ~JsonConfig() = default;
- JsonConfig() = delete;
- JsonConfig(const JsonConfig&) = delete;
- JsonConfig(JsonConfig&&) = delete;
- JsonConfig& operator=(const JsonConfig&) = delete;
- JsonConfig& operator=(JsonConfig&&) = delete;
- ~JsonConfig() = default;
+ /**
+ * Constructor
+ * Parses and populates the fan presence policies from a json file
+ *
+ * @param[in] bus - sdbusplus bus object
+ */
+ explicit JsonConfig(sdbusplus::bus::bus& bus);
- /**
- * Constructor
- * Parses and populates the fan presence policies from a json file
- *
- * @param[in] bus - sdbusplus bus object
- */
- explicit JsonConfig(sdbusplus::bus::bus& bus);
+ /**
+ * @brief Get the json config based fan presence policies
+ *
+ * @return - The fan presence policies
+ */
+ static const policies& get();
- /**
- * @brief Get the json config based fan presence policies
- *
- * @return - The fan presence policies
- */
- static const policies& get();
+ /**
+ * @brief Callback function to handle receiving a HUP signal to
+ * reload the json configuration.
+ *
+ * @param[in] sigSrc - sd_event_source signal wrapper
+ * @param[in] sigInfo - signal info on signal fd
+ */
+ void sighupHandler(sdeventplus::source::Signal& sigSrc,
+ const struct signalfd_siginfo* sigInfo);
- /**
- * @brief Callback function to handle receiving a HUP signal to
- * reload the json configuration.
- *
- * @param[in] sigSrc - sd_event_source signal wrapper
- * @param[in] sigInfo - signal info on signal fd
- */
- void sighupHandler(sdeventplus::source::Signal& sigSrc,
- const struct signalfd_siginfo* sigInfo);
+ private:
+ /* Fan presence policies */
+ static policies _policies;
- private:
+ /* The sdbusplus bus object */
+ sdbusplus::bus::bus& _bus;
- /* Fan presence policies */
- static policies _policies;
+ /* Config file to be used */
+ fs::path _confFile;
- /* The sdbusplus bus object */
- sdbusplus::bus::bus& _bus;
+ /* List of Fan objects to have presence policies */
+ std::vector<fanPolicy> _fans;
- /* Config file to be used */
- fs::path _confFile;
+ /* Presence methods mapping to their associated handler function */
+ static const std::map<std::string, methodHandler> _methods;
- /* List of Fan objects to have presence policies */
- std::vector<fanPolicy> _fans;
+ /**
+ * Presence redundancy policy mapping to their associated handler
+ * function
+ */
+ static const std::map<std::string, rpolicyHandler> _rpolicies;
- /* Presence methods mapping to their associated handler function */
- static const std::map<std::string, methodHandler> _methods;
+ /**
+ * Get the json configuration file. The first location found to contain
+ * the json config file is used from the following locations in order.
+ * 1.) confOverridePath ("/etc/phosphor-fan-presence/presence")
+ * 2.) confBasePath ("/usr/share/phosphor-fan-presence/presence")
+ * 3.) From first dbus object found hosting
+ * interface = Interface set in confDbusIntf
+ * property = Property set in confDbusProp
+ */
+ const fs::path getConfFile();
- /**
- * Presence redundancy policy mapping to their associated handler
- * function
- */
- static const std::map<std::string, rpolicyHandler> _rpolicies;
+ /**
+ * @brief Load the json config file
+ */
+ void load();
- /**
- * Get the json configuration file. The first location found to contain
- * the json config file is used from the following locations in order.
- * 1.) confOverridePath ("/etc/phosphor-fan-presence/presence")
- * 2.) confBasePath ("/usr/share/phosphor-fan-presence/presence")
- * 3.) From first dbus object found hosting
- * interface = Interface set in confDbusIntf
- * property = Property set in confDbusProp
- */
- const fs::path getConfFile();
+ /**
+ * @brief Process the json config to extract the defined fan presence
+ * policies.
+ *
+ * @param[in] jsonConf - parsed json configuration data
+ */
+ void process(const json& jsonConf);
- /**
- * @brief Load the json config file
- */
- void load();
-
- /**
- * @brief Process the json config to extract the defined fan presence
- * policies.
- *
- * @param[in] jsonConf - parsed json configuration data
- */
- void process(const json& jsonConf);
-
- /**
- * @brief Get the redundancy policy of presence detection for a fan
- *
- * @param[in] rpolicy - policy type to construct
- * @param[in] fpolicy - fan policy object
- *
- * @return - The constructed redundancy policy type for the fan
- */
- std::unique_ptr<RedundancyPolicy> getPolicy(const json& rpolicy,
- const fanPolicy& fpolicy);
+ /**
+ * @brief Get the redundancy policy of presence detection for a fan
+ *
+ * @param[in] rpolicy - policy type to construct
+ * @param[in] fpolicy - fan policy object
+ *
+ * @return - The constructed redundancy policy type for the fan
+ */
+ std::unique_ptr<RedundancyPolicy> getPolicy(const json& rpolicy,
+ const fanPolicy& fpolicy);
};
/**
@@ -141,27 +140,25 @@
*/
namespace method
{
- /**
- * @brief Fan presence detection method by tach feedback
- *
- * @param[in] fanIndex - fan object index to add tach method
- * @param[in] method - json properties for a tach method
- *
- * @return - A presence sensor to detect fan presence by tach feedback
- */
- std::unique_ptr<PresenceSensor> getTach(size_t fanIndex,
- const json& method);
+/**
+ * @brief Fan presence detection method by tach feedback
+ *
+ * @param[in] fanIndex - fan object index to add tach method
+ * @param[in] method - json properties for a tach method
+ *
+ * @return - A presence sensor to detect fan presence by tach feedback
+ */
+std::unique_ptr<PresenceSensor> getTach(size_t fanIndex, const json& method);
- /**
- * @brief Fan presence detection method by gpio
- *
- * @param[in] fanIndex - fan object index to add gpio method
- * @param[in] method - json properties for a gpio method
- *
- * @return - A presence sensor to detect fan presence by gpio
- */
- std::unique_ptr<PresenceSensor> getGpio(size_t fanIndex,
- const json& method);
+/**
+ * @brief Fan presence detection method by gpio
+ *
+ * @param[in] fanIndex - fan object index to add gpio method
+ * @param[in] method - json properties for a gpio method
+ *
+ * @return - A presence sensor to detect fan presence by gpio
+ */
+std::unique_ptr<PresenceSensor> getGpio(size_t fanIndex, const json& method);
} // namespace method
@@ -170,27 +167,27 @@
*/
namespace rpolicy
{
- /**
- * @brief Create an `Anyof` redundancy policy on the created presence
- * sensors for a fan
- *
- * @param[in] fan - fan policy object with the presence sensors for the fan
- *
- * @return - An `Anyof` redundancy policy
- */
- std::unique_ptr<RedundancyPolicy> getAnyof(const fanPolicy& fan);
+/**
+ * @brief Create an `Anyof` redundancy policy on the created presence
+ * sensors for a fan
+ *
+ * @param[in] fan - fan policy object with the presence sensors for the fan
+ *
+ * @return - An `Anyof` redundancy policy
+ */
+std::unique_ptr<RedundancyPolicy> getAnyof(const fanPolicy& fan);
- /**
- * @brief Create a `Fallback` redundancy policy on the created presence
- * sensors for a fan
- *
- * @param[in] fan - fan policy object with the presence sensors for the fan
- *
- * @return - A `Fallback` redundancy policy
- */
- std::unique_ptr<RedundancyPolicy> getFallback(const fanPolicy& fan);
+/**
+ * @brief Create a `Fallback` redundancy policy on the created presence
+ * sensors for a fan
+ *
+ * @param[in] fan - fan policy object with the presence sensors for the fan
+ *
+ * @return - A `Fallback` redundancy policy
+ */
+std::unique_ptr<RedundancyPolicy> getFallback(const fanPolicy& fan);
-} // namespace policy
+} // namespace rpolicy
} // namespace presence
} // namespace fan