From 02bd667376e90e9d6926135596fa4f1859144eb8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 13 Nov 2024 11:45:26 +0100 Subject: [PATCH] better typedefs --- src/fsfw/serialize/SerializableListElement.h | 56 +++++++++---------- .../devicedefinitions/testDeviceDefinitions.h | 6 +- unittests/mock/poolDefinitions.h | 6 +- unittests/serialize/testList.cpp | 6 +- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/fsfw/serialize/SerializableListElement.h b/src/fsfw/serialize/SerializableListElement.h index 7bbc6051..b7bc0a66 100644 --- a/src/fsfw/serialize/SerializableListElement.h +++ b/src/fsfw/serialize/SerializableListElement.h @@ -9,13 +9,13 @@ namespace serialize { template -class ListElement : public SerializeIF { +class ListVariable : public SerializeIF { public: template - explicit ListElement(List& list, Args... args) : entry(std::forward(args)...) { + explicit ListVariable(List& list, Args... args) : entry(std::forward(args)...) { list.addSerializable(*this); } - explicit ListElement(List& list) : entry() { list.addSerializable(*this); } + explicit ListVariable(List& list) : entry() { list.addSerializable(*this); } ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize, Endianness streamEndianness) const override { @@ -33,7 +33,7 @@ class ListElement : public SerializeIF { explicit operator T() { return entry; } - ListElement& operator=(T newValue) { + ListVariable& operator=(T newValue) { entry = newValue; return *this; } @@ -46,27 +46,27 @@ class ListElement : public SerializeIF { }; template -using LE = ListElement; +using LVar = ListVariable; -using le_u8 = LE; -using le_u16 = LE; -using le_u32 = LE; -using le_u64 = LE; -using le_i8 = LE; -using le_i16 = LE; -using le_i32 = LE; -using le_i64 = LE; -using le_f32 = LE; -using le_f64 = LE; +using lvar_u8 = LVar; +using lvar_u16 = LVar; +using lvar_u32 = LVar; +using lvar_u64 = LVar; +using lvar_i8 = LVar; +using lvar_i16 = LVar; +using lvar_i32 = LVar; +using lvar_i64 = LVar; +using lvar_f32 = LVar; +using lvar_f64 = LVar; template -class ListArrayElement : public SerializeIF { +class ListVector : public SerializeIF { public: template - explicit ListArrayElement(List& list, Args... args) : entry(std::forward(args)...) { + explicit ListVector(List& list, Args... args) : entry(std::forward(args)...) { list.addSerializable(*this); } - explicit ListArrayElement(List& list) : entry() { list.addSerializable(*this); } + explicit ListVector(List& list) : entry() { list.addSerializable(*this); } ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize, Endianness streamEndianness) const override { @@ -98,7 +98,7 @@ class ListArrayElement : public SerializeIF { explicit operator T() { return entry; } - ListArrayElement& operator=(T newValue[N]) { + ListVector& operator=(T newValue[N]) { entry = newValue; return *this; } @@ -130,23 +130,23 @@ class ListArrayElement : public SerializeIF { }; template -using LAE = ListArrayElement; +using LVec = ListVector; template -using lae_u8 = LAE; +using lvec_u8 = LVec; template -using lae_u16 = LAE; +using lvec_u16 = LVec; template -using lae_u32 = LAE; +using lvec_u32 = LVec; template -using lae_i8 = LAE; +using lvec_i8 = LVec; template -using lae_i16 = LAE; +using lvec_i16 = LVec; template -using lae_i32 = LAE; +using lvec_i32 = LVec; template -using lae_f32 = LAE; +using lvec_f32 = LVec; template -using lae_f64 = LAE; +using lvec_f64 = LVec; } // namespace serialize diff --git a/src/fsfw_tests/integration/devices/devicedefinitions/testDeviceDefinitions.h b/src/fsfw_tests/integration/devices/devicedefinitions/testDeviceDefinitions.h index 45681144..d6557cbc 100644 --- a/src/fsfw_tests/integration/devices/devicedefinitions/testDeviceDefinitions.h +++ b/src/fsfw_tests/integration/devices/devicedefinitions/testDeviceDefinitions.h @@ -75,9 +75,9 @@ static constexpr uint8_t TEST_SET_ID = TEST_NORMAL_MODE_CMD; class TestDataSet : public serialize::List { public: - serialize::LE testU8{*this}; - serialize::LE testU32{*this}; - serialize::LAE testFloat3Vec{*this}; + serialize::LVar testU8{*this}; + serialize::LVar testU32{*this}; + serialize::LVec testFloat3Vec{*this}; }; } // namespace testdevice diff --git a/unittests/mock/poolDefinitions.h b/unittests/mock/poolDefinitions.h index 81794eb3..0df455e1 100644 --- a/unittests/mock/poolDefinitions.h +++ b/unittests/mock/poolDefinitions.h @@ -38,9 +38,9 @@ static const g_id_t uint64Vec2Id = g_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, i class Dataset : public List { public: - LE u8Element{*this}; - LE u16Element{*this}; - LAE floatVec{*this}; + LVar u8Element{*this}; + LVar u16Element{*this}; + LVec floatVec{*this}; }; class StaticTestDataset : public StaticSharedSet<3> { diff --git a/unittests/serialize/testList.cpp b/unittests/serialize/testList.cpp index 36ad4ada..19fbb4cd 100644 --- a/unittests/serialize/testList.cpp +++ b/unittests/serialize/testList.cpp @@ -7,9 +7,9 @@ using namespace serialize; class ExampleSet0 : public List { public: - LE val0{*this}; - LE val1{*this}; - LAE val2{*this}; + LVar val0{*this}; + LVar val1{*this}; + LVec val2{*this}; }; using namespace returnvalue;