FSFW Update #28

Merged
jgerhards merged 782 commits from fsfw_update into develop 2023-05-28 23:43:22 +02:00
765 changed files with 10786 additions and 7729 deletions
Showing only changes of commit 8e6cee7761 - Show all commits

View File

@@ -10,19 +10,19 @@
namespace util { namespace util {
struct RawData { struct RawData {
const uint8_t* data; const uint8_t* data = nullptr;
size_t len; size_t len = 0;
}; };
enum DataTypes { RAW, SERIALIZABLE }; enum DataTypes { NONE, RAW, SERIALIZABLE };
union DataUnion { union DataUnion {
RawData raw; RawData raw;
SerializeIF* serializable; SerializeIF* serializable = nullptr;
}; };
struct DataWrapper { struct DataWrapper {
DataTypes type; DataTypes type = DataTypes::NONE;
DataUnion dataUnion; DataUnion dataUnion;
using BufPairT = std::pair<const uint8_t*, size_t>; using BufPairT = std::pair<const uint8_t*, size_t>;
@@ -35,6 +35,14 @@ struct DataWrapper {
return 0; return 0;
} }
[[nodiscard]] bool isNull() const {
if ((type == DataTypes::NONE) or (type == DataTypes::RAW and dataUnion.raw.data == nullptr) or
(type == DataTypes::SERIALIZABLE and dataUnion.serializable == nullptr)) {
return true;
}
return false;
}
void setRawData(BufPairT bufPair) { void setRawData(BufPairT bufPair) {
type = DataTypes::RAW; type = DataTypes::RAW;
dataUnion.raw.data = bufPair.first; dataUnion.raw.data = bufPair.first;