From 571a436c2e14be3dfda17077fafec7fccff8b3cf Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Tue, 2 May 2023 16:11:41 +0200 Subject: [PATCH] goose: small formatting fixes Signed-off-by: Steffen Vogel --- include/villas/nodes/iec61850_goose.hpp | 44 ++++++++++++++++--------- lib/nodes/iec61850_goose.cpp | 9 +++-- 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/include/villas/nodes/iec61850_goose.hpp b/include/villas/nodes/iec61850_goose.hpp index 63afc69a1..2c97eea49 100644 --- a/include/villas/nodes/iec61850_goose.hpp +++ b/include/villas/nodes/iec61850_goose.hpp @@ -16,14 +16,16 @@ #include #include #include + +#include +#include +#include + #include #include #include #include #include -#include -#include -#include namespace villas { namespace node { @@ -58,24 +60,29 @@ public: SignalType signalType() const; // Create a GooseSignal from an MmsValue - static std::optional fromMmsValue(MmsValue *mms_value); + static + std::optional fromMmsValue(MmsValue *mms_value); // Create a GooseSignal from type name and SignalData value - static std::optional fromNameAndValue(char const *name, SignalData value, std::optional meta = std::nullopt); + static + std::optional fromNameAndValue(char const *name, SignalData value, std::optional meta = std::nullopt); // Create a MmsValue from this GooseSignal MmsValue * toMmsValue() const; - static std::optional lookupMmsType(int mms_type); + static + std::optional lookupMmsType(int mms_type); - static std::optional lookupMmsTypeName(char const *name); + static + std::optional lookupMmsTypeName(char const *name); GooseSignal(Type type, SignalData value, std::optional meta = std::nullopt); SignalData signal_data; Meta meta; private: - inline static std::array const descriptors { + inline static + std::array const descriptors { Descriptor { "boolean", SignalType::BOOLEAN, MmsType::MMS_BOOLEAN }, Descriptor { "int8", SignalType::INTEGER, MmsType::MMS_INTEGER, {.size = 8 } }, Descriptor { "int16", SignalType::INTEGER, MmsType::MMS_INTEGER, {.size = 16 } }, @@ -89,13 +96,17 @@ private: Descriptor { "float64", SignalType::FLOAT, MmsType::MMS_FLOAT, {.size = 64 } }, }; - static MmsValue * newMmsInteger(int64_t i, int size); + static + MmsValue * newMmsInteger(int64_t i, int size); - static MmsValue * newMmsUnsigned(uint64_t i, int size); + static + MmsValue * newMmsUnsigned(uint64_t i, int size); - static MmsValue * newMmsBitString(uint32_t i, int size); + static + MmsValue * newMmsBitString(uint32_t i, int size); - static MmsValue * newMmsFloat(double i, int size); + static + MmsValue * newMmsFloat(double i, int size); // Descriptor within the descriptors table above Descriptor const *descriptor; @@ -194,13 +205,16 @@ protected: void startPublishers() noexcept(false); void stopPublishers() noexcept; - static void onEvent(GooseSubscriber subscriber, InputEventContext &context) noexcept; + static + void onEvent(GooseSubscriber subscriber, InputEventContext &context) noexcept; void addSubscriber(InputEventContext &ctx) noexcept; void pushSample(uint64_t timestamp) noexcept; - static void publish_values(GoosePublisher publisher, std::vector &values, bool changed, int burst = 1) noexcept; - static void resend_thread(GooseNode::Output *output) noexcept; + static + void publish_values(GoosePublisher publisher, std::vector &values, bool changed, int burst = 1) noexcept; + static + void resend_thread(GooseNode::Output *output) noexcept; void parseInput(json_t *json); void parseSubscriber(json_t *json, SubscriberConfig &sc); diff --git a/lib/nodes/iec61850_goose.cpp b/lib/nodes/iec61850_goose.cpp index 20b3e99c2..39b718b31 100644 --- a/lib/nodes/iec61850_goose.cpp +++ b/lib/nodes/iec61850_goose.cpp @@ -7,6 +7,7 @@ #include #include + #include #include #include @@ -14,14 +15,16 @@ #include #include +using namespace std::literals::chrono_literals; +using namespace std::literals::string_literals; + using namespace villas; using namespace villas::node; using namespace villas::utils; using namespace villas::node::iec61850; -using namespace std::literals::chrono_literals; -using namespace std::literals::string_literals; -static std::optional> stringToMac(char *mac_string) +static +std::optional> stringToMac(char *mac_string) { std::array mac; char *save;