add .clang-format
Change-Id: I6627b5569c2e0f730be7331403218b823a2c622f
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/pid/zone.hpp b/pid/zone.hpp
index 1934a66..99a8f14 100644
--- a/pid/zone.hpp
+++ b/pid/zone.hpp
@@ -1,39 +1,36 @@
#pragma once
+#include "conf.hpp"
+#include "controller.hpp"
+#include "sensors/manager.hpp"
+#include "sensors/sensor.hpp"
+#include "xyz/openbmc_project/Control/Mode/server.hpp"
+
#include <fstream>
#include <map>
#include <memory>
+#include <sdbusplus/bus.hpp>
+#include <sdbusplus/server.hpp>
#include <set>
#include <string>
#include <vector>
-#include "conf.hpp"
-#include "controller.hpp"
-#include "sensors/sensor.hpp"
-#include "sensors/manager.hpp"
-
-#include "xyz/openbmc_project/Control/Mode/server.hpp"
-#include <sdbusplus/bus.hpp>
-#include <sdbusplus/server.hpp>
-
-
template <typename... T>
using ServerObject = typename sdbusplus::server::object::object<T...>;
-using ModeInterface =
- sdbusplus::xyz::openbmc_project::Control::server::Mode;
+using ModeInterface = sdbusplus::xyz::openbmc_project::Control::server::Mode;
using ModeObject = ServerObject<ModeInterface>;
class ZoneInterface
{
- public:
- virtual ~ZoneInterface() = default;
+ public:
+ virtual ~ZoneInterface() = default;
- virtual double getCachedValue(const std::string& name) = 0;
- virtual void addRPMSetPoint(float setpoint) = 0;
- virtual float getMaxRPMRequest() const = 0;
- virtual bool getFailSafeMode() const = 0;
- virtual float getFailSafePercent() const = 0;
- virtual Sensor* getSensor(std::string name) = 0;
+ virtual double getCachedValue(const std::string& name) = 0;
+ virtual void addRPMSetPoint(float setpoint) = 0;
+ virtual float getMaxRPMRequest() const = 0;
+ virtual bool getFailSafeMode() const = 0;
+ virtual float getFailSafePercent() const = 0;
+ virtual Sensor* getSensor(std::string name) = 0;
};
/*
@@ -43,84 +40,77 @@
*/
class PIDZone : public ZoneInterface, public ModeObject
{
- public:
- PIDZone(int64_t zone,
- float minThermalRpm,
- float failSafePercent,
- const SensorManager& mgr,
- sdbusplus::bus::bus& bus,
- const char* objPath,
- bool defer)
- : ModeObject(bus, objPath, defer),
- _zoneId(zone),
- _maximumRPMSetPt(),
- _minThermalRpmSetPt(minThermalRpm),
- _failSafePercent(failSafePercent),
- _mgr(mgr)
- {
+ public:
+ PIDZone(int64_t zone, float minThermalRpm, float failSafePercent,
+ const SensorManager& mgr, sdbusplus::bus::bus& bus,
+ const char* objPath, bool defer) :
+ ModeObject(bus, objPath, defer),
+ _zoneId(zone), _maximumRPMSetPt(), _minThermalRpmSetPt(minThermalRpm),
+ _failSafePercent(failSafePercent), _mgr(mgr)
+ {
#ifdef __TUNING_LOGGING__
- _log.open("/tmp/swampd.log");
+ _log.open("/tmp/swampd.log");
#endif
- }
+ }
- float getMaxRPMRequest(void) const override;
- bool getManualMode(void) const;
+ float getMaxRPMRequest(void) const override;
+ bool getManualMode(void) const;
- /* Could put lock around this since it's accessed from two threads, but
- * only one reader/one writer.
- */
- void setManualMode(bool mode);
- bool getFailSafeMode(void) const override;
- int64_t getZoneId(void) const;
- void addRPMSetPoint(float setpoint) override;
- void clearRPMSetPoints(void);
- float getFailSafePercent(void) const override;
- float getMinThermalRpmSetPt(void) const;
+ /* Could put lock around this since it's accessed from two threads, but
+ * only one reader/one writer.
+ */
+ void setManualMode(bool mode);
+ bool getFailSafeMode(void) const override;
+ int64_t getZoneId(void) const;
+ void addRPMSetPoint(float setpoint) override;
+ void clearRPMSetPoints(void);
+ float getFailSafePercent(void) const override;
+ float getMinThermalRpmSetPt(void) const;
- Sensor* getSensor(std::string name) override;
- void determineMaxRPMRequest(void);
- void updateFanTelemetry(void);
- void updateSensors(void);
- void initializeCache(void);
- void dumpCache(void);
- void process_fans(void);
- void process_thermals(void);
+ Sensor* getSensor(std::string name) override;
+ void determineMaxRPMRequest(void);
+ void updateFanTelemetry(void);
+ void updateSensors(void);
+ void initializeCache(void);
+ void dumpCache(void);
+ void process_fans(void);
+ void process_thermals(void);
- void addFanPID(std::unique_ptr<PIDController> pid);
- void addThermalPID(std::unique_ptr<PIDController> pid);
- double getCachedValue(const std::string& name) override;
- void addFanInput(std::string fan);
- void addThermalInput(std::string therm);
+ void addFanPID(std::unique_ptr<PIDController> pid);
+ void addThermalPID(std::unique_ptr<PIDController> pid);
+ double getCachedValue(const std::string& name) override;
+ void addFanInput(std::string fan);
+ void addThermalInput(std::string therm);
#ifdef __TUNING_LOGGING__
- void initializeLog(void);
- std::ofstream& getLogHandle(void);
+ void initializeLog(void);
+ std::ofstream& getLogHandle(void);
#endif
- /* Method for setting the manual mode over dbus */
- bool manual(bool value) override;
- /* Method for reading whether in fail-safe mode over dbus */
- bool failSafe() const override;
+ /* Method for setting the manual mode over dbus */
+ bool manual(bool value) override;
+ /* Method for reading whether in fail-safe mode over dbus */
+ bool failSafe() const override;
- private:
+ private:
#ifdef __TUNING_LOGGING__
- std::ofstream _log;
+ std::ofstream _log;
#endif
- const int64_t _zoneId;
- float _maximumRPMSetPt = 0;
- bool _manualMode = false;
- const float _minThermalRpmSetPt;
- const float _failSafePercent;
+ const int64_t _zoneId;
+ float _maximumRPMSetPt = 0;
+ bool _manualMode = false;
+ const float _minThermalRpmSetPt;
+ const float _failSafePercent;
- std::set<std::string> _failSafeSensors;
+ std::set<std::string> _failSafeSensors;
- std::vector<float> _RPMSetPoints;
- std::vector<std::string> _fanInputs;
- std::vector<std::string> _thermalInputs;
- std::map<std::string, double> _cachedValuesByName;
- const SensorManager& _mgr;
+ std::vector<float> _RPMSetPoints;
+ std::vector<std::string> _fanInputs;
+ std::vector<std::string> _thermalInputs;
+ std::map<std::string, double> _cachedValuesByName;
+ const SensorManager& _mgr;
- std::vector<std::unique_ptr<PIDController>> _fans;
- std::vector<std::unique_ptr<PIDController>> _thermals;
+ std::vector<std::unique_ptr<PIDController>> _fans;
+ std::vector<std::unique_ptr<PIDController>> _thermals;
};