better typedefs
This commit is contained in:
parent
8ff5cf604f
commit
02bd667376
@ -9,13 +9,13 @@
|
||||
namespace serialize {
|
||||
|
||||
template <typename T>
|
||||
class ListElement : public SerializeIF {
|
||||
class ListVariable : public SerializeIF {
|
||||
public:
|
||||
template <typename... Args>
|
||||
explicit ListElement(List& list, Args... args) : entry(std::forward<Args>(args)...) {
|
||||
explicit ListVariable(List& list, Args... args) : entry(std::forward<Args>(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 <typename T>
|
||||
using LE = ListElement<T>;
|
||||
using LVar = ListVariable<T>;
|
||||
|
||||
using le_u8 = LE<uint8_t>;
|
||||
using le_u16 = LE<uint16_t>;
|
||||
using le_u32 = LE<uint32_t>;
|
||||
using le_u64 = LE<uint64_t>;
|
||||
using le_i8 = LE<int8_t>;
|
||||
using le_i16 = LE<int16_t>;
|
||||
using le_i32 = LE<int32_t>;
|
||||
using le_i64 = LE<int64_t>;
|
||||
using le_f32 = LE<float>;
|
||||
using le_f64 = LE<double>;
|
||||
using lvar_u8 = LVar<uint8_t>;
|
||||
using lvar_u16 = LVar<uint16_t>;
|
||||
using lvar_u32 = LVar<uint32_t>;
|
||||
using lvar_u64 = LVar<uint64_t>;
|
||||
using lvar_i8 = LVar<int8_t>;
|
||||
using lvar_i16 = LVar<int16_t>;
|
||||
using lvar_i32 = LVar<int32_t>;
|
||||
using lvar_i64 = LVar<int64_t>;
|
||||
using lvar_f32 = LVar<float>;
|
||||
using lvar_f64 = LVar<double>;
|
||||
|
||||
template <typename T, size_t N>
|
||||
class ListArrayElement : public SerializeIF {
|
||||
class ListVector : public SerializeIF {
|
||||
public:
|
||||
template <typename... Args>
|
||||
explicit ListArrayElement(List& list, Args... args) : entry(std::forward<Args>(args)...) {
|
||||
explicit ListVector(List& list, Args... args) : entry(std::forward<Args>(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 <typename T, size_t N>
|
||||
using LAE = ListArrayElement<T, N>;
|
||||
using LVec = ListVector<T, N>;
|
||||
|
||||
template <size_t N>
|
||||
using lae_u8 = LAE<uint8_t, N>;
|
||||
using lvec_u8 = LVec<uint8_t, N>;
|
||||
template <size_t N>
|
||||
using lae_u16 = LAE<uint16_t, N>;
|
||||
using lvec_u16 = LVec<uint16_t, N>;
|
||||
template <size_t N>
|
||||
using lae_u32 = LAE<uint32_t, N>;
|
||||
using lvec_u32 = LVec<uint32_t, N>;
|
||||
template <size_t N>
|
||||
using lae_i8 = LAE<int8_t, N>;
|
||||
using lvec_i8 = LVec<int8_t, N>;
|
||||
template <size_t N>
|
||||
using lae_i16 = LAE<int16_t, N>;
|
||||
using lvec_i16 = LVec<int16_t, N>;
|
||||
template <size_t N>
|
||||
using lae_i32 = LAE<int32_t, N>;
|
||||
using lvec_i32 = LVec<int32_t, N>;
|
||||
template <size_t N>
|
||||
using lae_f32 = LAE<float, N>;
|
||||
using lvec_f32 = LVec<float, N>;
|
||||
template <size_t N>
|
||||
using lae_f64 = LAE<double, N>;
|
||||
using lvec_f64 = LVec<double, N>;
|
||||
|
||||
} // namespace serialize
|
||||
|
@ -75,9 +75,9 @@ static constexpr uint8_t TEST_SET_ID = TEST_NORMAL_MODE_CMD;
|
||||
|
||||
class TestDataSet : public serialize::List {
|
||||
public:
|
||||
serialize::LE<uint8_t> testU8{*this};
|
||||
serialize::LE<uint32_t> testU32{*this};
|
||||
serialize::LAE<float, 3> testFloat3Vec{*this};
|
||||
serialize::LVar<uint8_t> testU8{*this};
|
||||
serialize::LVar<uint32_t> testU32{*this};
|
||||
serialize::LVec<float, 3> testFloat3Vec{*this};
|
||||
};
|
||||
|
||||
} // namespace testdevice
|
||||
|
@ -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<uint8_t> u8Element{*this};
|
||||
LE<uint16_t> u16Element{*this};
|
||||
LAE<float, 3> floatVec{*this};
|
||||
LVar<uint8_t> u8Element{*this};
|
||||
LVar<uint16_t> u16Element{*this};
|
||||
LVec<float, 3> floatVec{*this};
|
||||
};
|
||||
|
||||
class StaticTestDataset : public StaticSharedSet<3> {
|
||||
|
@ -7,9 +7,9 @@ using namespace serialize;
|
||||
|
||||
class ExampleSet0 : public List {
|
||||
public:
|
||||
LE<uint8_t> val0{*this};
|
||||
LE<uint32_t> val1{*this};
|
||||
LAE<uint16_t, 3> val2{*this};
|
||||
LVar<uint8_t> val0{*this};
|
||||
LVar<uint32_t> val1{*this};
|
||||
LVec<uint16_t, 3> val2{*this};
|
||||
};
|
||||
|
||||
using namespace returnvalue;
|
||||
|
Loading…
Reference in New Issue
Block a user