clang-format: copy latest and re-format
clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.
Change-Id: I152f141a5e8343b92b5ce81d3ca16eec77b5606b
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/control/json/actions/net_target_increase.cpp b/control/json/actions/net_target_increase.cpp
index cc08cfa..878dd3f 100644
--- a/control/json/actions/net_target_increase.cpp
+++ b/control/json/actions/net_target_increase.cpp
@@ -44,7 +44,6 @@
void NetTargetIncrease::run(Zone& zone)
{
-
if (!_stateParameter.empty())
{
auto s = Manager::getParameter(_stateParameter);
@@ -59,80 +58,77 @@
for (const auto& group : _groups)
{
const auto& members = group.getMembers();
- std::for_each(
- members.begin(), members.end(),
- [this, &zone, &group, &netDelta](const auto& member) {
- try
+ std::for_each(members.begin(), members.end(),
+ [this, &zone, &group, &netDelta](const auto& member) {
+ try
+ {
+ auto value = Manager::getObjValueVariant(
+ member, group.getInterface(), group.getProperty());
+ if (std::holds_alternative<int64_t>(value) ||
+ std::holds_alternative<double>(value))
{
- auto value = Manager::getObjValueVariant(
- member, group.getInterface(), group.getProperty());
- if (std::holds_alternative<int64_t>(value) ||
- std::holds_alternative<double>(value))
+ // Where a group of int/doubles are greater than or
+ // equal to the state(some value) provided, request an
+ // increase of the configured delta times the difference
+ // between the group member's value and configured state
+ // value.
+ if (value >= _state)
{
- // Where a group of int/doubles are greater than or
- // equal to the state(some value) provided, request an
- // increase of the configured delta times the difference
- // between the group member's value and configured state
- // value.
- if (value >= _state)
+ uint64_t incDelta = 0;
+ if (auto dblPtr = std::get_if<double>(&value))
{
- uint64_t incDelta = 0;
- if (auto dblPtr = std::get_if<double>(&value))
- {
- incDelta = static_cast<uint64_t>(
- (*dblPtr - std::get<double>(_state)) *
- _delta);
- }
- else
- {
- // Increase by at least a single delta
- // to attempt bringing under provided 'state'
- auto deltaFactor =
- std::max((std::get<int64_t>(value) -
- std::get<int64_t>(_state)),
- int64_t(1));
- incDelta =
- static_cast<uint64_t>(deltaFactor * _delta);
- }
- netDelta = std::max(netDelta, incDelta);
+ incDelta = static_cast<uint64_t>(
+ (*dblPtr - std::get<double>(_state)) * _delta);
}
- }
- else if (std::holds_alternative<bool>(value))
- {
- // Where a group of booleans equal the state(`true` or
- // `false`) provided, request an increase of the
- // configured delta
- if (_state == value)
+ else
{
- netDelta = std::max(netDelta, _delta);
+ // Increase by at least a single delta
+ // to attempt bringing under provided 'state'
+ auto deltaFactor =
+ std::max((std::get<int64_t>(value) -
+ std::get<int64_t>(_state)),
+ int64_t(1));
+ incDelta =
+ static_cast<uint64_t>(deltaFactor * _delta);
}
- }
- else if (std::holds_alternative<std::string>(value))
- {
- // Where a group of strings equal the state(some string)
- // provided, request an increase of the configured delta
- if (_state == value)
- {
- netDelta = std::max(netDelta, _delta);
- }
- }
- else
- {
- // Unsupported group member type for this action
- log<level::ERR>(
- fmt::format(
- "Action {}: Unsupported group member type "
- "given. [object = {} : {} : {}]",
- ActionBase::getName(), member,
- group.getInterface(), group.getProperty())
- .c_str());
+ netDelta = std::max(netDelta, incDelta);
}
}
- catch (const std::out_of_range& oore)
+ else if (std::holds_alternative<bool>(value))
{
- // Property value not found, netDelta unchanged
+ // Where a group of booleans equal the state(`true` or
+ // `false`) provided, request an increase of the
+ // configured delta
+ if (_state == value)
+ {
+ netDelta = std::max(netDelta, _delta);
+ }
}
- });
+ else if (std::holds_alternative<std::string>(value))
+ {
+ // Where a group of strings equal the state(some string)
+ // provided, request an increase of the configured delta
+ if (_state == value)
+ {
+ netDelta = std::max(netDelta, _delta);
+ }
+ }
+ else
+ {
+ // Unsupported group member type for this action
+ log<level::ERR>(
+ fmt::format("Action {}: Unsupported group member type "
+ "given. [object = {} : {} : {}]",
+ ActionBase::getName(), member,
+ group.getInterface(), group.getProperty())
+ .c_str());
+ }
+ }
+ catch (const std::out_of_range& oore)
+ {
+ // Property value not found, netDelta unchanged
+ }
+ });
}
// Request increase to target
zone.requestIncrease(netDelta);