Update clang format
Style only change
Change-Id: I41c97cbfb6a0ebf155a34166bc627f49a398442b
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/.clang-format b/.clang-format
index dd27708..ea71ad6 100644
--- a/.clang-format
+++ b/.clang-format
@@ -17,7 +17,7 @@
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
-AlwaysBreakTemplateDeclarations: false
+AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
@@ -42,7 +42,7 @@
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
-DerivePointerAlignment: true
+DerivePointerAlignment: false
PointerAlignment: Left
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
@@ -79,9 +79,9 @@
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
-PointerAlignment: Right
ReflowComments: true
SortIncludes: true
+SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
@@ -96,3 +96,4 @@
TabWidth: 4
UseTab: Never
...
+
diff --git a/include/ADCSensor.hpp b/include/ADCSensor.hpp
index 2397093..fd248da 100644
--- a/include/ADCSensor.hpp
+++ b/include/ADCSensor.hpp
@@ -7,17 +7,17 @@
class ADCSensor : public Sensor
{
public:
- ADCSensor(const std::string &path,
- sdbusplus::asio::object_server &objectServer,
- std::shared_ptr<sdbusplus::asio::connection> &conn,
- boost::asio::io_service &io, const std::string &sensorName,
- std::vector<thresholds::Threshold> &&thresholds,
+ ADCSensor(const std::string& path,
+ sdbusplus::asio::object_server& objectServer,
+ std::shared_ptr<sdbusplus::asio::connection>& conn,
+ boost::asio::io_service& io, const std::string& sensorName,
+ std::vector<thresholds::Threshold>&& thresholds,
const double scaleFactor, PowerState readState,
- const std::string &sensorConfiguration);
+ const std::string& sensorConfiguration);
~ADCSensor();
private:
- sdbusplus::asio::object_server &objServer;
+ sdbusplus::asio::object_server& objServer;
boost::asio::posix::stream_descriptor inputDev;
boost::asio::deadline_timer waitTimer;
boost::asio::streambuf readBuf;
@@ -25,6 +25,6 @@
double scaleFactor;
PowerState readState;
void setupRead(void);
- void handleResponse(const boost::system::error_code &err);
+ void handleResponse(const boost::system::error_code& err);
void checkThresholds(void) override;
};
diff --git a/include/CPUSensor.hpp b/include/CPUSensor.hpp
index 10c1f4e..a38c84e 100644
--- a/include/CPUSensor.hpp
+++ b/include/CPUSensor.hpp
@@ -7,23 +7,23 @@
class CPUSensor : public Sensor
{
public:
- CPUSensor(const std::string &path, const std::string &objectType,
- sdbusplus::asio::object_server &objectServer,
- std::shared_ptr<sdbusplus::asio::connection> &conn,
- boost::asio::io_service &io, const std::string &fanName,
- std::vector<thresholds::Threshold> &&thresholds,
- const std::string &configuration);
+ CPUSensor(const std::string& path, const std::string& objectType,
+ sdbusplus::asio::object_server& objectServer,
+ std::shared_ptr<sdbusplus::asio::connection>& conn,
+ boost::asio::io_service& io, const std::string& fanName,
+ std::vector<thresholds::Threshold>&& thresholds,
+ const std::string& configuration);
~CPUSensor();
static constexpr unsigned int sensorScaleFactor = 1000;
static constexpr unsigned int sensorPollMs = 1000;
private:
- sdbusplus::asio::object_server &objServer;
+ sdbusplus::asio::object_server& objServer;
boost::asio::posix::stream_descriptor inputDev;
boost::asio::deadline_timer waitTimer;
boost::asio::streambuf readBuf;
int errCount;
void setupRead(void);
- void handleResponse(const boost::system::error_code &err);
+ void handleResponse(const boost::system::error_code& err);
void checkThresholds(void) override;
};
diff --git a/include/ExitAirTempSensor.hpp b/include/ExitAirTempSensor.hpp
index bd8b675..e06c20d 100644
--- a/include/ExitAirTempSensor.hpp
+++ b/include/ExitAirTempSensor.hpp
@@ -18,14 +18,14 @@
std::shared_ptr<ExitAirTempSensor> parent;
- CFMSensor(std::shared_ptr<sdbusplus::asio::connection> &conn,
- const std::string &name, const std::string &sensorConfiguration,
- sdbusplus::asio::object_server &objectServer,
- std::vector<thresholds::Threshold> &&thresholds,
- std::shared_ptr<ExitAirTempSensor> &parent);
+ CFMSensor(std::shared_ptr<sdbusplus::asio::connection>& conn,
+ const std::string& name, const std::string& sensorConfiguration,
+ sdbusplus::asio::object_server& objectServer,
+ std::vector<thresholds::Threshold>&& thresholds,
+ std::shared_ptr<ExitAirTempSensor>& parent);
~CFMSensor();
- bool calculate(double &);
+ bool calculate(double&);
void updateReading(void);
void checkThresholds(void) override;
@@ -35,8 +35,8 @@
boost::container::flat_map<std::string, std::pair<double, double>>
tachRanges;
std::shared_ptr<sdbusplus::asio::connection> dbusConnection;
- sdbusplus::asio::object_server &objServer;
- void addTachRanges(const std::string &serviceName, const std::string &path);
+ sdbusplus::asio::object_server& objServer;
+ void addTachRanges(const std::string& serviceName, const std::string& path);
};
struct ExitAirTempSensor : public Sensor
@@ -54,11 +54,11 @@
boost::container::flat_map<std::string, double> powerReadings;
std::vector<std::unique_ptr<CFMSensor>> cfmSensors;
- ExitAirTempSensor(std::shared_ptr<sdbusplus::asio::connection> &conn,
- const std::string &name,
- const std::string &sensorConfiguration,
- sdbusplus::asio::object_server &objectServer,
- std::vector<thresholds::Threshold> &&thresholds);
+ ExitAirTempSensor(std::shared_ptr<sdbusplus::asio::connection>& conn,
+ const std::string& name,
+ const std::string& sensorConfiguration,
+ sdbusplus::asio::object_server& objectServer,
+ std::vector<thresholds::Threshold>&& thresholds);
~ExitAirTempSensor();
void checkThresholds(void) override;
@@ -73,6 +73,6 @@
std::shared_ptr<sdbusplus::asio::connection> dbusConnection;
std::chrono::time_point<std::chrono::system_clock> lastTime;
double getTotalCFM(void);
- bool calculate(double &val);
+ bool calculate(double& val);
void setupMatches(void);
};
diff --git a/include/HwmonTempSensor.hpp b/include/HwmonTempSensor.hpp
index 3e582ab..9343576 100644
--- a/include/HwmonTempSensor.hpp
+++ b/include/HwmonTempSensor.hpp
@@ -7,21 +7,21 @@
class HwmonTempSensor : public Sensor
{
public:
- HwmonTempSensor(const std::string &path, const std::string &objectType,
- sdbusplus::asio::object_server &objectServer,
- std::shared_ptr<sdbusplus::asio::connection> &conn,
- boost::asio::io_service &io, const std::string &fanName,
- std::vector<thresholds::Threshold> &&thresholds,
- const std::string &sensorConfiguration);
+ HwmonTempSensor(const std::string& path, const std::string& objectType,
+ sdbusplus::asio::object_server& objectServer,
+ std::shared_ptr<sdbusplus::asio::connection>& conn,
+ boost::asio::io_service& io, const std::string& fanName,
+ std::vector<thresholds::Threshold>&& thresholds,
+ const std::string& sensorConfiguration);
~HwmonTempSensor();
private:
- sdbusplus::asio::object_server &objServer;
+ sdbusplus::asio::object_server& objServer;
boost::asio::posix::stream_descriptor inputDev;
boost::asio::deadline_timer waitTimer;
boost::asio::streambuf readBuf;
int errCount;
void setupRead(void);
- void handleResponse(const boost::system::error_code &err);
+ void handleResponse(const boost::system::error_code& err);
void checkThresholds(void) override;
};
\ No newline at end of file
diff --git a/include/IpmbSensor.hpp b/include/IpmbSensor.hpp
index d5b0290..b6bfa32 100644
--- a/include/IpmbSensor.hpp
+++ b/include/IpmbSensor.hpp
@@ -17,11 +17,11 @@
struct IpmbSensor : public Sensor
{
- IpmbSensor(std::shared_ptr<sdbusplus::asio::connection> &conn,
- boost::asio::io_service &io, const std::string &name,
- const std::string &sensorConfiguration,
- sdbusplus::asio::object_server &objectServer,
- std::vector<thresholds::Threshold> &&thresholds,
+ IpmbSensor(std::shared_ptr<sdbusplus::asio::connection>& conn,
+ boost::asio::io_service& io, const std::string& name,
+ const std::string& sensorConfiguration,
+ sdbusplus::asio::object_server& objectServer,
+ std::vector<thresholds::Threshold>&& thresholds,
uint8_t deviceAddress);
~IpmbSensor();
@@ -43,7 +43,7 @@
PowerState readState = PowerState::on;
private:
- sdbusplus::asio::object_server &objectServer;
+ sdbusplus::asio::object_server& objectServer;
std::shared_ptr<sdbusplus::asio::connection> dbusConnection;
boost::asio::deadline_timer waitTimer;
};
\ No newline at end of file
diff --git a/include/TachSensor.hpp b/include/TachSensor.hpp
index 9fc50a6..1e01859 100644
--- a/include/TachSensor.hpp
+++ b/include/TachSensor.hpp
@@ -6,13 +6,13 @@
#include <sdbusplus/asio/object_server.hpp>
#include <sensor.hpp>
-constexpr const char *gpioPath = "/sys/class/gpio/";
+constexpr const char* gpioPath = "/sys/class/gpio/";
class PresenceSensor
{
public:
PresenceSensor(const size_t index, bool inverted,
- boost::asio::io_service &io);
+ boost::asio::io_service& io);
~PresenceSensor();
void monitorPresence(void);
@@ -29,35 +29,35 @@
class RedundancySensor
{
public:
- RedundancySensor(size_t count, const std::vector<std::string> &children,
- sdbusplus::asio::object_server &objectServer);
+ RedundancySensor(size_t count, const std::vector<std::string>& children,
+ sdbusplus::asio::object_server& objectServer);
~RedundancySensor();
- void update(const std::string &name, bool failed);
+ void update(const std::string& name, bool failed);
private:
size_t count;
std::shared_ptr<sdbusplus::asio::dbus_interface> iface;
- sdbusplus::asio::object_server &objectServer;
+ sdbusplus::asio::object_server& objectServer;
boost::container::flat_map<std::string, bool> statuses;
};
class TachSensor : public Sensor
{
public:
- TachSensor(const std::string &path, const std::string &objectType,
- sdbusplus::asio::object_server &objectServer,
- std::shared_ptr<sdbusplus::asio::connection> &conn,
- std::unique_ptr<PresenceSensor> &&presence,
- const std::shared_ptr<RedundancySensor> &redundancy,
- boost::asio::io_service &io, const std::string &fanName,
- std::vector<thresholds::Threshold> &&thresholds,
- const std::string &sensorConfiguration,
- const std::pair<size_t, size_t> &limits);
+ TachSensor(const std::string& path, const std::string& objectType,
+ sdbusplus::asio::object_server& objectServer,
+ std::shared_ptr<sdbusplus::asio::connection>& conn,
+ std::unique_ptr<PresenceSensor>&& presence,
+ const std::shared_ptr<RedundancySensor>& redundancy,
+ boost::asio::io_service& io, const std::string& fanName,
+ std::vector<thresholds::Threshold>&& thresholds,
+ const std::string& sensorConfiguration,
+ const std::pair<size_t, size_t>& limits);
~TachSensor();
private:
- sdbusplus::asio::object_server &objServer;
+ sdbusplus::asio::object_server& objServer;
std::shared_ptr<RedundancySensor> redundancy;
std::unique_ptr<PresenceSensor> presence;
boost::asio::posix::stream_descriptor inputDev;
@@ -65,6 +65,6 @@
boost::asio::streambuf readBuf;
int errCount;
void setupRead(void);
- void handleResponse(const boost::system::error_code &err);
+ void handleResponse(const boost::system::error_code& err);
void checkThresholds(void) override;
};
diff --git a/include/Thresholds.hpp b/include/Thresholds.hpp
index 3f9aa79..8bcc4fa 100644
--- a/include/Thresholds.hpp
+++ b/include/Thresholds.hpp
@@ -17,7 +17,7 @@
};
struct Threshold
{
- Threshold(const Level &lev, const Direction &dir, const double &val,
+ Threshold(const Level& lev, const Direction& dir, const double& val,
bool write = true) :
level(lev),
direction(dir), value(val), writeable(write)
@@ -31,25 +31,25 @@
};
bool parseThresholdsFromConfig(
- const SensorData &sensorData,
- std::vector<thresholds::Threshold> &thresholdVector,
- const std::string *matchLabel = nullptr);
+ const SensorData& sensorData,
+ std::vector<thresholds::Threshold>& thresholdVector,
+ const std::string* matchLabel = nullptr);
-bool parseThresholdsFromAttr(std::vector<thresholds::Threshold> &thresholds,
- const std::string &inputPath,
- const double &scaleFactor);
+bool parseThresholdsFromAttr(std::vector<thresholds::Threshold>& thresholds,
+ const std::string& inputPath,
+ const double& scaleFactor);
bool hasCriticalInterface(
- const std::vector<thresholds::Threshold> &thresholdVector);
+ const std::vector<thresholds::Threshold>& thresholdVector);
bool hasWarningInterface(
- const std::vector<thresholds::Threshold> &thresholdVector);
+ const std::vector<thresholds::Threshold>& thresholdVector);
-void persistThreshold(const std::string &baseInterface, const std::string &path,
- const thresholds::Threshold &threshold,
- std::shared_ptr<sdbusplus::asio::connection> &conn);
+void persistThreshold(const std::string& baseInterface, const std::string& path,
+ const thresholds::Threshold& threshold,
+ std::shared_ptr<sdbusplus::asio::connection>& conn);
// returns false if a critical threshold has been crossed, true otherwise
-bool checkThresholds(Sensor *sensor);
-void assertThresholds(Sensor *sensor, thresholds::Level level,
+bool checkThresholds(Sensor* sensor);
+void assertThresholds(Sensor* sensor, thresholds::Level level,
thresholds::Direction direction, bool assert);
} // namespace thresholds
diff --git a/include/VariantVisitors.hpp b/include/VariantVisitors.hpp
index 7b23977..6549a32 100644
--- a/include/VariantVisitors.hpp
+++ b/include/VariantVisitors.hpp
@@ -22,7 +22,8 @@
struct VariantToFloatVisitor
{
- template <typename T> float operator()(const T &t) const
+ template <typename T>
+ float operator()(const T& t) const
{
if constexpr (std::is_arithmetic_v<T>)
{
@@ -34,7 +35,8 @@
struct VariantToIntVisitor
{
- template <typename T> int operator()(const T &t) const
+ template <typename T>
+ int operator()(const T& t) const
{
if constexpr (std::is_arithmetic_v<T>)
{
@@ -46,7 +48,8 @@
struct VariantToUnsignedIntVisitor
{
- template <typename T> unsigned int operator()(const T &t) const
+ template <typename T>
+ unsigned int operator()(const T& t) const
{
if constexpr (std::is_arithmetic_v<T>)
{
@@ -58,7 +61,8 @@
struct VariantToStringVisitor
{
- template <typename T> std::string operator()(const T &t) const
+ template <typename T>
+ std::string operator()(const T& t) const
{
if constexpr (std::is_same_v<T, std::string>)
{
@@ -74,7 +78,8 @@
struct VariantToDoubleVisitor
{
- template <typename T> double operator()(const T &t) const
+ template <typename T>
+ double operator()(const T& t) const
{
if constexpr (std::is_arithmetic_v<T>)
{
diff --git a/include/sensor.hpp b/include/sensor.hpp
index 73e44d2..de790c8 100644
--- a/include/sensor.hpp
+++ b/include/sensor.hpp
@@ -6,9 +6,9 @@
constexpr size_t sensorFailedPollTimeMs = 5000;
struct Sensor
{
- Sensor(const std::string &name, const std::string &path,
- std::vector<thresholds::Threshold> &&thresholdData,
- const std::string &configurationPath, const std::string &objectType,
+ Sensor(const std::string& name, const std::string& path,
+ std::vector<thresholds::Threshold>&& thresholdData,
+ const std::string& configurationPath, const std::string& objectType,
const double max, const double min) :
name(name),
path(path), thresholds(std::move(thresholdData)),
@@ -32,7 +32,7 @@
bool overridenState = false;
bool internalSet = false;
- int setSensorValue(const double &newValue, double &oldValue)
+ int setSensorValue(const double& newValue, double& oldValue)
{
if (internalSet)
{
@@ -46,16 +46,16 @@
}
void
- setInitialProperties(std::shared_ptr<sdbusplus::asio::connection> &conn)
+ setInitialProperties(std::shared_ptr<sdbusplus::asio::connection>& conn)
{
sensorInterface->register_property("MaxValue", maxValue);
sensorInterface->register_property("MinValue", minValue);
sensorInterface->register_property(
- "Value", value, [&](const double &newValue, double &oldValue) {
+ "Value", value, [&](const double& newValue, double& oldValue) {
return setSensorValue(newValue, oldValue);
});
- for (auto &threshold : thresholds)
+ for (auto& threshold : thresholds)
{
std::shared_ptr<sdbusplus::asio::dbus_interface> iface;
std::string level;
@@ -101,7 +101,7 @@
}
iface->register_property(
level, threshold.value,
- [&](const double &request, double &oldValue) {
+ [&](const double& request, double& oldValue) {
oldValue = request; // todo, just let the config do this?
threshold.value = request;
thresholds::persistThreshold(configurationPath, objectType,
@@ -127,7 +127,7 @@
}
}
- void updateValue(const double &newValue)
+ void updateValue(const double& newValue)
{
// Indicate that it is internal set call
internalSet = true;
diff --git a/src/ADCSensor.cpp b/src/ADCSensor.cpp
index eb2587c..e06c8dd 100644
--- a/src/ADCSensor.cpp
+++ b/src/ADCSensor.cpp
@@ -36,13 +36,13 @@
static constexpr double maxReading = 20;
static constexpr double minReading = 0;
-ADCSensor::ADCSensor(const std::string &path,
- sdbusplus::asio::object_server &objectServer,
- std::shared_ptr<sdbusplus::asio::connection> &conn,
- boost::asio::io_service &io, const std::string &sensorName,
- std::vector<thresholds::Threshold> &&_thresholds,
+ADCSensor::ADCSensor(const std::string& path,
+ sdbusplus::asio::object_server& objectServer,
+ std::shared_ptr<sdbusplus::asio::connection>& conn,
+ boost::asio::io_service& io, const std::string& sensorName,
+ std::vector<thresholds::Threshold>&& _thresholds,
const double scaleFactor, PowerState readState,
- const std::string &sensorConfiguration) :
+ const std::string& sensorConfiguration) :
Sensor(boost::replace_all_copy(sensorName, " ", "_"), path,
std::move(_thresholds), sensorConfiguration,
"xyz.openbmc_project.Configuration.ADC", maxReading, minReading),
@@ -86,11 +86,11 @@
{
boost::asio::async_read_until(
inputDev, readBuf, '\n',
- [&](const boost::system::error_code &ec,
+ [&](const boost::system::error_code& ec,
std::size_t /*bytes_transfered*/) { handleResponse(ec); });
}
-void ADCSensor::handleResponse(const boost::system::error_code &err)
+void ADCSensor::handleResponse(const boost::system::error_code& err)
{
if (err == boost::system::errc::bad_file_descriptor)
{
@@ -153,7 +153,7 @@
}
inputDev.assign(fd);
waitTimer.expires_from_now(boost::posix_time::milliseconds(sensorPollMs));
- waitTimer.async_wait([&](const boost::system::error_code &ec) {
+ waitTimer.async_wait([&](const boost::system::error_code& ec) {
if (ec == boost::asio::error::operation_aborted)
{
return; // we're being canceled
diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp
index 969a449..0d0dd1b 100644
--- a/src/CPUSensor.cpp
+++ b/src/CPUSensor.cpp
@@ -31,12 +31,12 @@
static constexpr double maxReading = 127;
static constexpr double minReading = -128;
-CPUSensor::CPUSensor(const std::string &path, const std::string &objectType,
- sdbusplus::asio::object_server &objectServer,
- std::shared_ptr<sdbusplus::asio::connection> &conn,
- boost::asio::io_service &io, const std::string &sensorName,
- std::vector<thresholds::Threshold> &&_thresholds,
- const std::string &sensorConfiguration) :
+CPUSensor::CPUSensor(const std::string& path, const std::string& objectType,
+ sdbusplus::asio::object_server& objectServer,
+ std::shared_ptr<sdbusplus::asio::connection>& conn,
+ boost::asio::io_service& io, const std::string& sensorName,
+ std::vector<thresholds::Threshold>&& _thresholds,
+ const std::string& sensorConfiguration) :
Sensor(boost::replace_all_copy(sensorName, " ", "_"), path,
std::move(_thresholds), sensorConfiguration, objectType, maxReading,
minReading),
@@ -78,11 +78,11 @@
{
boost::asio::async_read_until(
inputDev, readBuf, '\n',
- [&](const boost::system::error_code &ec,
+ [&](const boost::system::error_code& ec,
std::size_t /*bytes_transfered*/) { handleResponse(ec); });
}
-void CPUSensor::handleResponse(const boost::system::error_code &err)
+void CPUSensor::handleResponse(const boost::system::error_code& err)
{
if (err == boost::system::errc::bad_file_descriptor)
{
@@ -109,7 +109,7 @@
}
errCount = 0;
}
- catch (const std::invalid_argument &)
+ catch (const std::invalid_argument&)
{
errCount++;
}
@@ -150,7 +150,7 @@
}
inputDev.assign(fd);
waitTimer.expires_from_now(boost::posix_time::milliseconds(pollTime));
- waitTimer.async_wait([&](const boost::system::error_code &ec) {
+ waitTimer.async_wait([&](const boost::system::error_code& ec) {
if (ec == boost::asio::error::operation_aborted)
{
return; // we're being canceled
diff --git a/src/HwmonTempSensor.cpp b/src/HwmonTempSensor.cpp
index 7d443ad..c7855f6 100644
--- a/src/HwmonTempSensor.cpp
+++ b/src/HwmonTempSensor.cpp
@@ -34,12 +34,12 @@
static constexpr double minReading = -128;
HwmonTempSensor::HwmonTempSensor(
- const std::string &path, const std::string &objectType,
- sdbusplus::asio::object_server &objectServer,
- std::shared_ptr<sdbusplus::asio::connection> &conn,
- boost::asio::io_service &io, const std::string &sensorName,
- std::vector<thresholds::Threshold> &&_thresholds,
- const std::string &sensorConfiguration) :
+ const std::string& path, const std::string& objectType,
+ sdbusplus::asio::object_server& objectServer,
+ std::shared_ptr<sdbusplus::asio::connection>& conn,
+ boost::asio::io_service& io, const std::string& sensorName,
+ std::vector<thresholds::Threshold>&& _thresholds,
+ const std::string& sensorConfiguration) :
Sensor(boost::replace_all_copy(sensorName, " ", "_"), path,
std::move(_thresholds), sensorConfiguration, objectType, maxReading,
minReading),
@@ -80,11 +80,11 @@
{
boost::asio::async_read_until(
inputDev, readBuf, '\n',
- [&](const boost::system::error_code &ec,
+ [&](const boost::system::error_code& ec,
std::size_t /*bytes_transfered*/) { handleResponse(ec); });
}
-void HwmonTempSensor::handleResponse(const boost::system::error_code &err)
+void HwmonTempSensor::handleResponse(const boost::system::error_code& err)
{
if (err == boost::system::errc::bad_file_descriptor)
{
@@ -109,7 +109,7 @@
}
errCount = 0;
}
- catch (const std::invalid_argument &)
+ catch (const std::invalid_argument&)
{
errCount++;
}
@@ -139,7 +139,7 @@
}
inputDev.assign(fd);
waitTimer.expires_from_now(boost::posix_time::milliseconds(sensorPollMs));
- waitTimer.async_wait([&](const boost::system::error_code &ec) {
+ waitTimer.async_wait([&](const boost::system::error_code& ec) {
if (ec == boost::asio::error::operation_aborted)
{
return; // we're being canceled
diff --git a/src/TachSensor.cpp b/src/TachSensor.cpp
index d16c36b..a88c248 100644
--- a/src/TachSensor.cpp
+++ b/src/TachSensor.cpp
@@ -31,15 +31,15 @@
static constexpr unsigned int pwmPollMs = 500;
static constexpr size_t warnAfterErrorCount = 10;
-TachSensor::TachSensor(const std::string &path, const std::string &objectType,
- sdbusplus::asio::object_server &objectServer,
- std::shared_ptr<sdbusplus::asio::connection> &conn,
- std::unique_ptr<PresenceSensor> &&presence,
- const std::shared_ptr<RedundancySensor> &redundancy,
- boost::asio::io_service &io, const std::string &fanName,
- std::vector<thresholds::Threshold> &&_thresholds,
- const std::string &sensorConfiguration,
- const std::pair<size_t, size_t> &limits) :
+TachSensor::TachSensor(const std::string& path, const std::string& objectType,
+ sdbusplus::asio::object_server& objectServer,
+ std::shared_ptr<sdbusplus::asio::connection>& conn,
+ std::unique_ptr<PresenceSensor>&& presence,
+ const std::shared_ptr<RedundancySensor>& redundancy,
+ boost::asio::io_service& io, const std::string& fanName,
+ std::vector<thresholds::Threshold>&& _thresholds,
+ const std::string& sensorConfiguration,
+ const std::pair<size_t, size_t>& limits) :
Sensor(boost::replace_all_copy(fanName, " ", "_"), path,
std::move(_thresholds), sensorConfiguration, objectType,
limits.second, limits.first),
@@ -82,11 +82,11 @@
{
boost::asio::async_read_until(
inputDev, readBuf, '\n',
- [&](const boost::system::error_code &ec,
+ [&](const boost::system::error_code& ec,
std::size_t /*bytes_transfered*/) { handleResponse(ec); });
}
-void TachSensor::handleResponse(const boost::system::error_code &err)
+void TachSensor::handleResponse(const boost::system::error_code& err)
{
if (err == boost::system::errc::bad_file_descriptor)
{
@@ -124,7 +124,7 @@
}
errCount = 0;
}
- catch (const std::invalid_argument &)
+ catch (const std::invalid_argument&)
{
errCount++;
}
@@ -162,7 +162,7 @@
}
inputDev.assign(fd);
waitTimer.expires_from_now(boost::posix_time::milliseconds(pollTime));
- waitTimer.async_wait([&](const boost::system::error_code &ec) {
+ waitTimer.async_wait([&](const boost::system::error_code& ec) {
if (ec == boost::asio::error::operation_aborted)
{
return; // we're being canceled
@@ -182,7 +182,7 @@
}
PresenceSensor::PresenceSensor(const size_t index, bool inverted,
- boost::asio::io_service &io) :
+ boost::asio::io_service& io) :
inverted(inverted),
inputDev(io)
{
@@ -218,7 +218,7 @@
void PresenceSensor::monitorPresence(void)
{
inputDev.async_wait(boost::asio::ip::tcp::socket::wait_error,
- [this](const boost::system::error_code &ec) {
+ [this](const boost::system::error_code& ec) {
if (ec == boost::system::errc::bad_file_descriptor)
{
return; // we're being destroyed
@@ -264,8 +264,8 @@
}
RedundancySensor::RedundancySensor(
- size_t count, const std::vector<std::string> &children,
- sdbusplus::asio::object_server &objectServer) :
+ size_t count, const std::vector<std::string>& children,
+ sdbusplus::asio::object_server& objectServer) :
count(count),
iface(objectServer.add_interface(
"/xyz/openbmc_project/control/FanRedundancy/Tach",
@@ -281,13 +281,13 @@
{
objectServer.remove_interface(iface);
}
-void RedundancySensor::update(const std::string &name, bool failed)
+void RedundancySensor::update(const std::string& name, bool failed)
{
statuses[name] = failed;
size_t failedCount = 0;
std::string state = "Full";
- for (const auto &status : statuses)
+ for (const auto& status : statuses)
{
if (status.second)
{
diff --git a/src/Thresholds.cpp b/src/Thresholds.cpp
index 1494396..725829e 100644
--- a/src/Thresholds.cpp
+++ b/src/Thresholds.cpp
@@ -12,7 +12,7 @@
namespace thresholds
{
-unsigned int toBusValue(const Level &level)
+unsigned int toBusValue(const Level& level)
{
switch (level)
{
@@ -31,7 +31,7 @@
}
}
-std::string toBusValue(const Direction &direction)
+std::string toBusValue(const Direction& direction)
{
switch (direction)
{
@@ -51,11 +51,11 @@
}
bool parseThresholdsFromConfig(
- const SensorData &sensorData,
- std::vector<thresholds::Threshold> &thresholdVector,
- const std::string *matchLabel)
+ const SensorData& sensorData,
+ std::vector<thresholds::Threshold>& thresholdVector,
+ const std::string* matchLabel)
{
- for (const auto &item : sensorData)
+ for (const auto& item : sensorData)
{
if (item.first.find("Thresholds") == std::string::npos)
{
@@ -107,9 +107,9 @@
return true;
}
-void persistThreshold(const std::string &path, const std::string &baseInterface,
- const thresholds::Threshold &threshold,
- std::shared_ptr<sdbusplus::asio::connection> &conn)
+void persistThreshold(const std::string& path, const std::string& baseInterface,
+ const thresholds::Threshold& threshold,
+ std::shared_ptr<sdbusplus::asio::connection>& conn)
{
for (int ii = 0; ii < maxThresholds; ii++)
{
@@ -117,9 +117,9 @@
baseInterface + ".Thresholds" + std::to_string(ii);
conn->async_method_call(
[&, path, threshold, thresholdInterface](
- const boost::system::error_code &ec,
- const boost::container::flat_map<std::string, BasicVariantType>
- &result) {
+ const boost::system::error_code& ec,
+ const boost::container::flat_map<std::string, BasicVariantType>&
+ result) {
if (ec)
{
return; // threshold not supported
@@ -147,7 +147,7 @@
std::variant<double> value(threshold.value);
conn->async_method_call(
- [](const boost::system::error_code &ec) {
+ [](const boost::system::error_code& ec) {
if (ec)
{
std::cerr << "Error setting threshold " << ec
@@ -162,7 +162,7 @@
}
}
-bool checkThresholds(Sensor *sensor)
+bool checkThresholds(Sensor* sensor)
{
bool status = true;
@@ -170,7 +170,7 @@
{
return true;
}
- for (auto &threshold : sensor->thresholds)
+ for (auto& threshold : sensor->thresholds)
{
if (std::isnan(sensor->value))
{
@@ -215,7 +215,7 @@
return status;
}
-void assertThresholds(Sensor *sensor, thresholds::Level level,
+void assertThresholds(Sensor* sensor, thresholds::Level level,
thresholds::Direction direction, bool assert)
{
std::string property;
@@ -258,14 +258,14 @@
interface->set_property(property, assert);
}
-static constexpr std::array<const char *, 4> attrTypes = {"lcrit", "min", "max",
- "crit"};
+static constexpr std::array<const char*, 4> attrTypes = {"lcrit", "min", "max",
+ "crit"};
bool parseThresholdsFromAttr(
- std::vector<thresholds::Threshold> &thresholdVector,
- const std::string &inputPath, const double &scaleFactor)
+ std::vector<thresholds::Threshold>& thresholdVector,
+ const std::string& inputPath, const double& scaleFactor)
{
- for (auto &type : attrTypes)
+ for (auto& type : attrTypes)
{
auto attrPath = boost::replace_all_copy(inputPath, "input", type);
std::ifstream attrFile(attrPath);
@@ -309,9 +309,9 @@
}
bool hasCriticalInterface(
- const std::vector<thresholds::Threshold> &thresholdVector)
+ const std::vector<thresholds::Threshold>& thresholdVector)
{
- for (auto &threshold : thresholdVector)
+ for (auto& threshold : thresholdVector)
{
if (threshold.level == Level::CRITICAL)
{
@@ -322,9 +322,9 @@
}
bool hasWarningInterface(
- const std::vector<thresholds::Threshold> &thresholdVector)
+ const std::vector<thresholds::Threshold>& thresholdVector)
{
- for (auto &threshold : thresholdVector)
+ for (auto& threshold : thresholdVector)
{
if (threshold.level == Level::WARNING)
{