Merge remote-tracking branch 'origin/development' into mueller/expand-retval-if

This commit is contained in:
2022-08-15 20:32:38 +02:00
6 changed files with 136 additions and 1 deletions

View File

@ -16,7 +16,7 @@
* This is the typedef for object identifiers.
* @ingroup system_objects
*/
typedef uint32_t object_id_t;
using object_id_t = uint32_t;
/**
* This interface allows a class to be included in the object manager

View File

@ -0,0 +1,52 @@
#ifndef FSFW_UTIL_UNSIGNEDBYTEFIELD_H
#define FSFW_UTIL_UNSIGNEDBYTEFIELD_H
#include "fsfw/serialize.h"
template<typename T>
class UnsignedByteField: public SerializeIF {
public:
static_assert(std::is_unsigned<T>::value);
explicit UnsignedByteField(T value): value(value) {}
[[nodiscard]] ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const override {
return SerializeAdapter::serialize(&value, buffer, size, maxSize, streamEndianness);
}
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) override {
return SerializeAdapter::deSerialize(&value, buffer, size, streamEndianness);
}
[[nodiscard]] size_t getSerializedSize() const override {
return sizeof(T);
}
[[nodiscard]] T getValue() const {
return value;
}
void setValue(T value_) {
value = value_;
}
private:
T value;
};
class U32ByteField: public UnsignedByteField<uint32_t> {
public:
explicit U32ByteField(uint32_t value): UnsignedByteField<uint32_t>(value) {}
};
class U16ByteField: public UnsignedByteField<uint16_t> {
public:
explicit U16ByteField(uint16_t value): UnsignedByteField<uint16_t>(value) {}
};
class U8ByteField: public UnsignedByteField<uint8_t> {
public:
explicit U8ByteField(uint8_t value): UnsignedByteField<uint8_t>(value) {}
};
#endif // FSFW_UTIL_UNSIGNEDBYTEFIELD_H