type update, assert that type is not boolean

This commit is contained in:
Robin Müller 2020-12-15 14:40:49 +01:00
parent 4d76bf24b5
commit 052e2ed1e8

View File

@ -3,6 +3,7 @@
#include "../returnvalues/HasReturnvaluesIF.h" #include "../returnvalues/HasReturnvaluesIF.h"
#include "../serialize/SerializeIF.h" #include "../serialize/SerializeIF.h"
#include <type_traits>
/** /**
* @brief Type definition for CCSDS or ECSS. * @brief Type definition for CCSDS or ECSS.
@ -56,13 +57,14 @@ private:
template<typename T> template<typename T>
struct PodTypeConversion { struct PodTypeConversion {
static_assert(not std::is_same<T, bool>::value,
"Do not use boolean for the PoolEntry type, use uint8_t "
"instead! The ECSS standard defines a boolean as a one bit "
"field. Therefore it is preferred to store a boolean as an "
"uint8_t");
static const Type::ActualType_t type = Type::UNKNOWN_TYPE; static const Type::ActualType_t type = Type::UNKNOWN_TYPE;
}; };
template<> template<>
struct PodTypeConversion<bool> {
static const Type::ActualType_t type = Type::UINT8_T;
};
template<>
struct PodTypeConversion<uint8_t> { struct PodTypeConversion<uint8_t> {
static const Type::ActualType_t type = Type::UINT8_T; static const Type::ActualType_t type = Type::UINT8_T;
}; };