validity buf generation set by ctor argument
This commit is contained in:
parent
c3898b3928
commit
f29b93b717
@ -8,10 +8,12 @@
|
|||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
PoolDataSetBase::PoolDataSetBase(PoolVariableIF** registeredVariablesArray,
|
PoolDataSetBase::PoolDataSetBase(PoolVariableIF** registeredVariablesArray,
|
||||||
const size_t maxFillCount)
|
const size_t maxFillCount, bool serializeWithValidityBlob)
|
||||||
: registeredVariables(registeredVariablesArray), maxFillCount(maxFillCount) {}
|
: registeredVariables(registeredVariablesArray),
|
||||||
|
maxFillCount(maxFillCount),
|
||||||
|
serializeWithValidityBlob(serializeWithValidityBlob) {}
|
||||||
|
|
||||||
PoolDataSetBase::~PoolDataSetBase() {}
|
PoolDataSetBase::~PoolDataSetBase() = default;
|
||||||
|
|
||||||
ReturnValue_t PoolDataSetBase::registerVariable(PoolVariableIF* variable) {
|
ReturnValue_t PoolDataSetBase::registerVariable(PoolVariableIF* variable) {
|
||||||
if (registeredVariables == nullptr) {
|
if (registeredVariables == nullptr) {
|
||||||
@ -174,6 +176,9 @@ ReturnValue_t PoolDataSetBase::unlockDataPool() { return returnvalue::OK; }
|
|||||||
|
|
||||||
ReturnValue_t PoolDataSetBase::serialize(uint8_t** buffer, size_t* size, const size_t maxSize,
|
ReturnValue_t PoolDataSetBase::serialize(uint8_t** buffer, size_t* size, const size_t maxSize,
|
||||||
SerializeIF::Endianness streamEndianness) const {
|
SerializeIF::Endianness streamEndianness) const {
|
||||||
|
if (this->serializeWithValidityBlob) {
|
||||||
|
return doSerializeWithValidityBlob(buffer, size, maxSize, streamEndianness);
|
||||||
|
}
|
||||||
ReturnValue_t result = returnvalue::FAILED;
|
ReturnValue_t result = returnvalue::FAILED;
|
||||||
for (uint16_t count = 0; count < fillCount; count++) {
|
for (uint16_t count = 0; count < fillCount; count++) {
|
||||||
result = registeredVariables[count]->serialize(buffer, size, maxSize, streamEndianness);
|
result = registeredVariables[count]->serialize(buffer, size, maxSize, streamEndianness);
|
||||||
@ -184,7 +189,7 @@ ReturnValue_t PoolDataSetBase::serialize(uint8_t** buffer, size_t* size, const s
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PoolDataSetBase::serializeWithValidityBlob(
|
ReturnValue_t PoolDataSetBase::doSerializeWithValidityBlob(
|
||||||
uint8_t** buffer, size_t* size, const size_t maxSize,
|
uint8_t** buffer, size_t* size, const size_t maxSize,
|
||||||
SerializeIF::Endianness streamEndianness) const {
|
SerializeIF::Endianness streamEndianness) const {
|
||||||
ReturnValue_t result = returnvalue::FAILED;
|
ReturnValue_t result = returnvalue::FAILED;
|
||||||
@ -204,7 +209,7 @@ ReturnValue_t PoolDataSetBase::serializeWithValidityBlob(
|
|||||||
uint8_t validBufferIndexBit = 0;
|
uint8_t validBufferIndexBit = 0;
|
||||||
for (uint16_t count = 0; count < fillCount; count++) {
|
for (uint16_t count = 0; count < fillCount; count++) {
|
||||||
if (registeredVariables[count]->isValid()) {
|
if (registeredVariables[count]->isValid()) {
|
||||||
/* Set bit at correct position */
|
// Set bit at correct position
|
||||||
bitutil::set(validityPtr + validBufferIndex, validBufferIndexBit);
|
bitutil::set(validityPtr + validBufferIndex, validBufferIndexBit);
|
||||||
}
|
}
|
||||||
if (validBufferIndexBit == 7) {
|
if (validBufferIndexBit == 7) {
|
||||||
|
@ -41,7 +41,8 @@ class PoolDataSetBase : public PoolDataSetIF, public SerializeIF {
|
|||||||
* supply a pointer to this dataset to PoolVariable
|
* supply a pointer to this dataset to PoolVariable
|
||||||
* initializations to register pool variables.
|
* initializations to register pool variables.
|
||||||
*/
|
*/
|
||||||
PoolDataSetBase(PoolVariableIF** registeredVariablesArray, size_t maxFillCount);
|
PoolDataSetBase(PoolVariableIF** registeredVariablesArray, size_t maxFillCount,
|
||||||
|
bool serializeWithValidityBlob);
|
||||||
|
|
||||||
/* Forbidden for now */
|
/* Forbidden for now */
|
||||||
PoolDataSetBase(const PoolDataSetBase& otherSet) = delete;
|
PoolDataSetBase(const PoolDataSetBase& otherSet) = delete;
|
||||||
@ -115,15 +116,15 @@ class PoolDataSetBase : public PoolDataSetIF, public SerializeIF {
|
|||||||
|
|
||||||
[[nodiscard]] uint16_t getFillCount() const override;
|
[[nodiscard]] uint16_t getFillCount() const override;
|
||||||
|
|
||||||
/* SerializeIF implementations */
|
// SerializeIF implementations
|
||||||
ReturnValue_t serialize(uint8_t** buffer, size_t* size, const size_t maxSize,
|
ReturnValue_t serialize(uint8_t** buffer, size_t* size, const size_t maxSize,
|
||||||
SerializeIF::Endianness streamEndianness) const override;
|
SerializeIF::Endianness streamEndianness) const override;
|
||||||
[[nodiscard]] size_t getSerializedSize() const override;
|
[[nodiscard]] size_t getSerializedSize() const override;
|
||||||
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
SerializeIF::Endianness streamEndianness) override;
|
SerializeIF::Endianness streamEndianness) override;
|
||||||
|
|
||||||
ReturnValue_t serializeWithValidityBlob(uint8_t** buffer, size_t* size, const size_t maxSize,
|
ReturnValue_t doSerializeWithValidityBlob(uint8_t** buffer, size_t* size, const size_t maxSize,
|
||||||
SerializeIF::Endianness streamEndianness) const;
|
SerializeIF::Endianness streamEndianness) const;
|
||||||
/**
|
/**
|
||||||
* Can be used to individually protect every read and commit call.
|
* Can be used to individually protect every read and commit call.
|
||||||
* @param protectEveryReadCommit
|
* @param protectEveryReadCommit
|
||||||
@ -165,6 +166,7 @@ class PoolDataSetBase : public PoolDataSetIF, public SerializeIF {
|
|||||||
*/
|
*/
|
||||||
PoolVariableIF** registeredVariables = nullptr;
|
PoolVariableIF** registeredVariables = nullptr;
|
||||||
const size_t maxFillCount = 0;
|
const size_t maxFillCount = 0;
|
||||||
|
bool serializeWithValidityBlob = false;
|
||||||
|
|
||||||
void setContainer(PoolVariableIF** variablesContainer);
|
void setContainer(PoolVariableIF** variablesContainer);
|
||||||
PoolVariableIF** getContainer() const;
|
PoolVariableIF** getContainer() const;
|
||||||
|
@ -2,14 +2,17 @@
|
|||||||
|
|
||||||
using namespace dp;
|
using namespace dp;
|
||||||
|
|
||||||
SharedSet::SharedSet(dp::SharedPool& sharedPool, uint32_t setId, const size_t maxNumberOfVariables)
|
SharedSet::SharedSet(dp::SharedPool& sharedPool, uint32_t setId, const size_t maxNumberOfVariables,
|
||||||
: SharedSetBase(sharedPool, setId, nullptr, maxNumberOfVariables),
|
bool serializeWithValídityBlob)
|
||||||
|
: SharedSetBase(sharedPool, setId, nullptr, maxNumberOfVariables, serializeWithValidityBlob),
|
||||||
poolVarList(maxNumberOfVariables) {
|
poolVarList(maxNumberOfVariables) {
|
||||||
this->setContainer(poolVarList.data());
|
this->setContainer(poolVarList.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedSet::SharedSet(dp::structure_id_t sid, const size_t maxNumberOfVariables)
|
SharedSet::SharedSet(dp::structure_id_t sid, const size_t maxNumberOfVariables,
|
||||||
: SharedSetBase(sid, nullptr, maxNumberOfVariables), poolVarList(maxNumberOfVariables) {
|
bool serializeWithValidityBlob)
|
||||||
|
: SharedSetBase(sid, nullptr, maxNumberOfVariables, serializeWithValidityBlob),
|
||||||
|
poolVarList(maxNumberOfVariables) {
|
||||||
this->setContainer(poolVarList.data());
|
this->setContainer(poolVarList.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,9 +21,9 @@ namespace datapool {
|
|||||||
*/
|
*/
|
||||||
class SharedSet : public SharedSetBase {
|
class SharedSet : public SharedSetBase {
|
||||||
public:
|
public:
|
||||||
SharedSet(SharedPool& sharedPool, uint32_t setId, size_t maxSize);
|
SharedSet(SharedPool& sharedPool, uint32_t setId, size_t maxSize, bool serializeWithValidityBlob);
|
||||||
|
|
||||||
SharedSet(sid_t sid, size_t maxSize);
|
SharedSet(sid_t sid, size_t maxSize, bool serializeWithValidityBlob);
|
||||||
|
|
||||||
~SharedSet() override;
|
~SharedSet() override;
|
||||||
|
|
||||||
|
@ -14,8 +14,9 @@ using namespace datapool;
|
|||||||
|
|
||||||
SharedSetBase::SharedSetBase(SharedPool &sharedPool, uint32_t setId,
|
SharedSetBase::SharedSetBase(SharedPool &sharedPool, uint32_t setId,
|
||||||
PoolVariableIF **registeredVariablesArray,
|
PoolVariableIF **registeredVariablesArray,
|
||||||
const size_t maxNumberOfVariables)
|
const size_t maxNumberOfVariables, bool serializeWithValidityBlob)
|
||||||
: base(registeredVariablesArray, maxNumberOfVariables), sharedPool(&sharedPool) {
|
: base(registeredVariablesArray, maxNumberOfVariables, serializeWithValidityBlob),
|
||||||
|
sharedPool(&sharedPool) {
|
||||||
mutexIfSingleDataCreator = sharedPool.getPoolMutex();
|
mutexIfSingleDataCreator = sharedPool.getPoolMutex();
|
||||||
|
|
||||||
this->sid.objectId = sharedPool.getOwnerId();
|
this->sid.objectId = sharedPool.getOwnerId();
|
||||||
@ -23,8 +24,8 @@ SharedSetBase::SharedSetBase(SharedPool &sharedPool, uint32_t setId,
|
|||||||
}
|
}
|
||||||
|
|
||||||
SharedSetBase::SharedSetBase(structure_id_t sid, PoolVariableIF **registeredVariablesArray,
|
SharedSetBase::SharedSetBase(structure_id_t sid, PoolVariableIF **registeredVariablesArray,
|
||||||
const size_t maxNumberOfVariables)
|
const size_t maxNumberOfVariables, bool serializeWithValidityBlob)
|
||||||
: base(registeredVariablesArray, maxNumberOfVariables) {
|
: base(registeredVariablesArray, maxNumberOfVariables, serializeWithValidityBlob) {
|
||||||
auto *hkOwner = ObjectManager::instance()->get<hk::GeneratesPeriodicHkIF>(sid.objectId);
|
auto *hkOwner = ObjectManager::instance()->get<hk::GeneratesPeriodicHkIF>(sid.objectId);
|
||||||
if (hkOwner != nullptr) {
|
if (hkOwner != nullptr) {
|
||||||
sharedPool = hkOwner->getOptionalSharedPool();
|
sharedPool = hkOwner->getOptionalSharedPool();
|
||||||
@ -37,8 +38,9 @@ SharedSetBase::SharedSetBase(structure_id_t sid, PoolVariableIF **registeredVari
|
|||||||
}
|
}
|
||||||
|
|
||||||
SharedSetBase::SharedSetBase(PoolVariableIF **registeredVariablesArray,
|
SharedSetBase::SharedSetBase(PoolVariableIF **registeredVariablesArray,
|
||||||
const size_t maxNumberOfVariables, bool protectEveryReadCommitCall)
|
const size_t maxNumberOfVariables, bool protectEveryReadCommitCall,
|
||||||
: base(registeredVariablesArray, maxNumberOfVariables) {
|
bool serializeWithValidityBlob)
|
||||||
|
: base(registeredVariablesArray, maxNumberOfVariables, serializeWithValidityBlob) {
|
||||||
base.setReadCommitProtectionBehaviour(protectEveryReadCommitCall);
|
base.setReadCommitProtectionBehaviour(protectEveryReadCommitCall);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,6 +105,9 @@ ReturnValue_t SharedSetBase::deSerialize(const uint8_t **buffer, size_t *size,
|
|||||||
|
|
||||||
ReturnValue_t SharedSetBase::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
ReturnValue_t SharedSetBase::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
||||||
SerializeIF::Endianness streamEndianness) const {
|
SerializeIF::Endianness streamEndianness) const {
|
||||||
|
if (serializeWithValidityBlob) {
|
||||||
|
return base.doSerializeWithValidityBlob(buffer, size, maxSize, streamEndianness);
|
||||||
|
}
|
||||||
return base.serialize(buffer, size, maxSize, streamEndianness);
|
return base.serialize(buffer, size, maxSize, streamEndianness);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,11 +117,6 @@ ReturnValue_t SharedSetBase::serialize(uint8_t **buffer, size_t *size, size_t ma
|
|||||||
return SerializeIF::serialize(buffer, serLen, maxSize, streamEndianness);
|
return SerializeIF::serialize(buffer, serLen, maxSize, streamEndianness);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] ReturnValue_t SharedSetBase::serializeWithValidityBlob(
|
|
||||||
uint8_t **buffer, size_t *size, size_t maxSize, Endianness streamEndianness) const {
|
|
||||||
return base.serializeWithValidityBlob(buffer, size, maxSize, streamEndianness);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SharedSetBase::setReportingEnabled(bool reportingEnabled) {
|
void SharedSetBase::setReportingEnabled(bool reportingEnabled) {
|
||||||
this->reportingEnabled = reportingEnabled;
|
this->reportingEnabled = reportingEnabled;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ class SharedSetBase : public SerializeIF, public PoolDataSetIF {
|
|||||||
* periodic handling.
|
* periodic handling.
|
||||||
*/
|
*/
|
||||||
SharedSetBase(SharedPool& sharedPool, uint32_t setId, PoolVariableIF** registeredVariablesArray,
|
SharedSetBase(SharedPool& sharedPool, uint32_t setId, PoolVariableIF** registeredVariablesArray,
|
||||||
size_t maxNumberOfVariables);
|
size_t maxNumberOfVariables, bool serializeWithValidityBlob);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Constructor for users of the local pool data, which need
|
* @brief Constructor for users of the local pool data, which need
|
||||||
@ -61,7 +61,8 @@ class SharedSetBase : public SerializeIF, public PoolDataSetIF {
|
|||||||
* @param registeredVariablesArray
|
* @param registeredVariablesArray
|
||||||
* @param maxNumberOfVariables
|
* @param maxNumberOfVariables
|
||||||
*/
|
*/
|
||||||
SharedSetBase(sid_t sid, PoolVariableIF** registeredVariablesArray, size_t maxNumberOfVariables);
|
SharedSetBase(sid_t sid, PoolVariableIF** registeredVariablesArray, size_t maxNumberOfVariables,
|
||||||
|
bool serializeWithValidityBlob);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Simple constructor, if the dataset is not the owner by
|
* @brief Simple constructor, if the dataset is not the owner by
|
||||||
@ -82,7 +83,7 @@ class SharedSetBase : public SerializeIF, public PoolDataSetIF {
|
|||||||
* commit calls separately.
|
* commit calls separately.
|
||||||
*/
|
*/
|
||||||
SharedSetBase(PoolVariableIF** registeredVariablesArray, size_t maxNumberOfVariables,
|
SharedSetBase(PoolVariableIF** registeredVariablesArray, size_t maxNumberOfVariables,
|
||||||
bool protectEveryReadCommitCall = true);
|
bool serializeWithValidityBlob, bool protectEveryReadCommitCall = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The destructor automatically manages writing the valid
|
* @brief The destructor automatically manages writing the valid
|
||||||
@ -116,10 +117,6 @@ class SharedSetBase : public SerializeIF, public PoolDataSetIF {
|
|||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
Endianness streamEndianness) override;
|
Endianness streamEndianness) override;
|
||||||
|
|
||||||
[[nodiscard]] virtual ReturnValue_t serializeWithValidityBlob(uint8_t** buffer, size_t* size,
|
|
||||||
size_t maxSize,
|
|
||||||
Endianness streamEndianness) const;
|
|
||||||
|
|
||||||
[[nodiscard]] dp::sid_t getStructureId() const;
|
[[nodiscard]] dp::sid_t getStructureId() const;
|
||||||
|
|
||||||
[[nodiscard]] size_t getSerializedSize() const override;
|
[[nodiscard]] size_t getSerializedSize() const override;
|
||||||
@ -162,6 +159,12 @@ class SharedSetBase : public SerializeIF, public PoolDataSetIF {
|
|||||||
*/
|
*/
|
||||||
void setChildrenValidity(bool valid);
|
void setChildrenValidity(bool valid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the valid state of a dataset is always relevant to the whole
|
||||||
|
* data set we can use this flag.
|
||||||
|
*/
|
||||||
|
bool serializeWithValidityBlob = false;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PoolDataSetBase base;
|
PoolDataSetBase base;
|
||||||
|
|
||||||
@ -176,12 +179,6 @@ class SharedSetBase : public SerializeIF, public PoolDataSetIF {
|
|||||||
|
|
||||||
void initializePeriodicHelper(float collectionInterval, dur_millis_t minimumPeriodicInterval);
|
void initializePeriodicHelper(float collectionInterval, dur_millis_t minimumPeriodicInterval);
|
||||||
|
|
||||||
/**
|
|
||||||
* If the valid state of a dataset is always relevant to the whole
|
|
||||||
* data set we can use this flag.
|
|
||||||
*/
|
|
||||||
bool valid = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is a small helper function to facilitate locking
|
* @brief This is a small helper function to facilitate locking
|
||||||
* the global data pool.
|
* the global data pool.
|
||||||
|
@ -28,8 +28,8 @@ class StaticSharedSet : public datapool::SharedSetBase {
|
|||||||
* @param sharedPool Shared pool this dataset will read from or write to.
|
* @param sharedPool Shared pool this dataset will read from or write to.
|
||||||
* @param setId
|
* @param setId
|
||||||
*/
|
*/
|
||||||
StaticSharedSet(SharedPool& sharedPool, const uint32_t setId)
|
StaticSharedSet(SharedPool& sharedPool, const uint32_t setId, bool serializeWithValidityBlob)
|
||||||
: SharedSetBase(sharedPool, setId, nullptr, NUM_VARIABLES) {
|
: SharedSetBase(sharedPool, setId, nullptr, NUM_VARIABLES, serializeWithValidityBlob) {
|
||||||
this->setContainer(poolVarList.data());
|
this->setContainer(poolVarList.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +37,8 @@ class StaticSharedSet : public datapool::SharedSetBase {
|
|||||||
* Constructor used by data users like controllers.
|
* Constructor used by data users like controllers.
|
||||||
* @param sid
|
* @param sid
|
||||||
*/
|
*/
|
||||||
explicit StaticSharedSet(const structure_id_t sid) : SharedSetBase(sid, nullptr, NUM_VARIABLES) {
|
explicit StaticSharedSet(const structure_id_t sid, bool serializeWithValidityBlob)
|
||||||
|
: SharedSetBase(sid, nullptr, NUM_VARIABLES, serializeWithValidityBlob) {
|
||||||
this->setContainer(poolVarList.data());
|
this->setContainer(poolVarList.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ class DeviceHandlerThermalSet : public dp::StaticSharedSet<2> {
|
|||||||
: DeviceHandlerThermalSet(hkOwner->getObjectId(), cfg) {}
|
: DeviceHandlerThermalSet(hkOwner->getObjectId(), cfg) {}
|
||||||
|
|
||||||
DeviceHandlerThermalSet(object_id_t deviceHandler, ThermalStateCfg cfg)
|
DeviceHandlerThermalSet(object_id_t deviceHandler, ThermalStateCfg cfg)
|
||||||
: StaticSharedSet(dp::structure_id_t(deviceHandler, cfg.thermalSetId)),
|
: StaticSharedSet(dp::structure_id_t(deviceHandler, cfg.thermalSetId), true),
|
||||||
thermalStatePoolId(cfg.thermalStatePoolId),
|
thermalStatePoolId(cfg.thermalStatePoolId),
|
||||||
heaterRequestPoolId(cfg.thermalRequestPoolId) {}
|
heaterRequestPoolId(cfg.thermalRequestPoolId) {}
|
||||||
|
|
||||||
|
@ -28,9 +28,9 @@ class Dataset : public SerializeIF {
|
|||||||
|
|
||||||
[[nodiscard]] size_t getNumberOfSerializables() const { return serializables.size(); }
|
[[nodiscard]] size_t getNumberOfSerializables() const { return serializables.size(); }
|
||||||
|
|
||||||
[[nodiscard]] ReturnValue_t serializeWithValidityBlob(uint8_t **buffer, size_t *size,
|
[[nodiscard]] ReturnValue_t doSerializeWithValidityBlob(uint8_t **buffer, size_t *size,
|
||||||
size_t maxSize,
|
size_t maxSize,
|
||||||
Endianness streamEndianness) const {
|
Endianness streamEndianness) const {
|
||||||
ReturnValue_t result = returnvalue::FAILED;
|
ReturnValue_t result = returnvalue::FAILED;
|
||||||
const uint8_t validityMaskSize = std::ceil(static_cast<float>(serializables.size()) / 8.0);
|
const uint8_t validityMaskSize = std::ceil(static_cast<float>(serializables.size()) / 8.0);
|
||||||
uint8_t *validityPtr = nullptr;
|
uint8_t *validityPtr = nullptr;
|
||||||
@ -76,6 +76,9 @@ class Dataset : public SerializeIF {
|
|||||||
|
|
||||||
[[nodiscard]] ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
[[nodiscard]] ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
||||||
Endianness streamEndianness) const override {
|
Endianness streamEndianness) const override {
|
||||||
|
if (serializeWithValidityBlob) {
|
||||||
|
return doSerializeWithValidityBlob(buffer, size, maxSize, streamEndianness);
|
||||||
|
}
|
||||||
ReturnValue_t result = returnvalue::OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
for (auto &serializable : serializables) {
|
for (auto &serializable : serializables) {
|
||||||
result = serializable.get().serialize(buffer, size, maxSize, streamEndianness);
|
result = serializable.get().serialize(buffer, size, maxSize, streamEndianness);
|
||||||
@ -111,6 +114,8 @@ class Dataset : public SerializeIF {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool serializeWithValidityBlob = false;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
dp::structure_id_t sid;
|
dp::structure_id_t sid;
|
||||||
std::vector<std::reference_wrapper<SerializableWithValidityIF>> serializables;
|
std::vector<std::reference_wrapper<SerializableWithValidityIF>> serializables;
|
||||||
|
@ -10,15 +10,16 @@ class InternalErrorDataset : public dp::StaticSharedSet<4> {
|
|||||||
public:
|
public:
|
||||||
static constexpr uint8_t ERROR_SET_ID = 0;
|
static constexpr uint8_t ERROR_SET_ID = 0;
|
||||||
|
|
||||||
InternalErrorDataset(dp::SharedPool& sharedPool) : StaticSharedSet(sharedPool, ERROR_SET_ID) {}
|
InternalErrorDataset(dp::SharedPool& sharedPool)
|
||||||
|
: StaticSharedSet(sharedPool, ERROR_SET_ID, false) {}
|
||||||
|
|
||||||
InternalErrorDataset(object_id_t objectId)
|
InternalErrorDataset(object_id_t objectId)
|
||||||
: StaticSharedSet(dp::structure_id_t(objectId, ERROR_SET_ID)) {}
|
: StaticSharedSet(dp::structure_id_t(objectId, ERROR_SET_ID), false) {}
|
||||||
|
|
||||||
|
dp::var_t<uint8_t> valid = dp::var_t<uint8_t>(sid.objectId, VALID, this);
|
||||||
dp::var_t<uint32_t> tmHits = dp::var_t<uint32_t>(sid.objectId, TM_HITS, this);
|
dp::var_t<uint32_t> tmHits = dp::var_t<uint32_t>(sid.objectId, TM_HITS, this);
|
||||||
dp::var_t<uint32_t> queueHits = dp::var_t<uint32_t>(sid.objectId, QUEUE_HITS, this);
|
dp::var_t<uint32_t> queueHits = dp::var_t<uint32_t>(sid.objectId, QUEUE_HITS, this);
|
||||||
dp::var_t<uint32_t> storeHits = dp::var_t<uint32_t>(sid.objectId, STORE_HITS, this);
|
dp::var_t<uint32_t> storeHits = dp::var_t<uint32_t>(sid.objectId, STORE_HITS, this);
|
||||||
dp::var_t<uint8_t> valid = dp::var_t<uint8_t>(sid.objectId, VALID, this);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FSFW_INTERNALERROR_INTERNALERRORDATASET_H_ */
|
#endif /* FSFW_INTERNALERROR_INTERNALERRORDATASET_H_ */
|
||||||
|
@ -29,9 +29,9 @@ class FuseSet : public datapool::StaticSharedSet<6> {
|
|||||||
public:
|
public:
|
||||||
static constexpr uint8_t FUSE_SET_ID = 0;
|
static constexpr uint8_t FUSE_SET_ID = 0;
|
||||||
|
|
||||||
FuseSet(dp::SharedPool &sharedPool) : StaticSharedSet(sharedPool, FUSE_SET_ID) {}
|
FuseSet(dp::SharedPool &sharedPool) : StaticSharedSet(sharedPool, FUSE_SET_ID, true) {}
|
||||||
|
|
||||||
FuseSet(object_id_t objectId) : StaticSharedSet(dp::sid_t(objectId, FUSE_SET_ID)) {}
|
FuseSet(object_id_t objectId) : StaticSharedSet(dp::sid_t(objectId, FUSE_SET_ID), true) {}
|
||||||
|
|
||||||
dp::f32_t voltage = dp::f32_t(sid.objectId, FusePoolId::VOLTAGE, this);
|
dp::f32_t voltage = dp::f32_t(sid.objectId, FusePoolId::VOLTAGE, this);
|
||||||
dp::f32_t current = dp::f32_t(sid.objectId, FusePoolId::CURRENT, this);
|
dp::f32_t current = dp::f32_t(sid.objectId, FusePoolId::CURRENT, this);
|
||||||
|
@ -21,10 +21,11 @@ class PowerSensorSet : public dp::StaticSharedSet<6> {
|
|||||||
public:
|
public:
|
||||||
static constexpr uint8_t POWER_SENSOR_SET_ID = 0;
|
static constexpr uint8_t POWER_SENSOR_SET_ID = 0;
|
||||||
|
|
||||||
PowerSensorSet(dp::SharedPool &sharedPool) : StaticSharedSet(sharedPool, POWER_SENSOR_SET_ID) {}
|
PowerSensorSet(dp::SharedPool &sharedPool)
|
||||||
|
: StaticSharedSet(sharedPool, POWER_SENSOR_SET_ID, true) {}
|
||||||
|
|
||||||
PowerSensorSet(object_id_t objectId)
|
PowerSensorSet(object_id_t objectId)
|
||||||
: StaticSharedSet(dp::sid_t(objectId, POWER_SENSOR_SET_ID)) {}
|
: StaticSharedSet(dp::sid_t(objectId, POWER_SENSOR_SET_ID), true) {}
|
||||||
|
|
||||||
dp::f32_t current{sid.objectId, PowerSensorPoolId::CURRENT, this};
|
dp::f32_t current{sid.objectId, PowerSensorPoolId::CURRENT, this};
|
||||||
dp::f32_t voltage{sid.objectId, PowerSensorPoolId::VOLTAGE, this};
|
dp::f32_t voltage{sid.objectId, PowerSensorPoolId::VOLTAGE, this};
|
||||||
|
@ -61,8 +61,9 @@ TEST_CASE("Pool Dataset Test", "[datapool]") {
|
|||||||
dataset.test1.setValid(true);
|
dataset.test1.setValid(true);
|
||||||
size_t serLen = 0;
|
size_t serLen = 0;
|
||||||
uint8_t* dataPtr = buf;
|
uint8_t* dataPtr = buf;
|
||||||
CHECK(dataset.serializeWithValidityBlob(&dataPtr, &serLen, sizeof(buf),
|
dataset.serializeWithValidityBlob = true;
|
||||||
SerializeIF::Endianness::NETWORK) == returnvalue::OK);
|
CHECK(dataset.serialize(&dataPtr, &serLen, sizeof(buf), SerializeIF::Endianness::NETWORK) ==
|
||||||
|
returnvalue::OK);
|
||||||
CHECK(buf[5] == 0b11000000);
|
CHECK(buf[5] == 0b11000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,8 +73,9 @@ TEST_CASE("Pool Dataset Test", "[datapool]") {
|
|||||||
datasetLarge.setAllChildrenValidity(true);
|
datasetLarge.setAllChildrenValidity(true);
|
||||||
size_t serLen = 0;
|
size_t serLen = 0;
|
||||||
uint8_t* dataPtr = buf;
|
uint8_t* dataPtr = buf;
|
||||||
CHECK(datasetLarge.serializeWithValidityBlob(
|
datasetLarge.serializeWithValidityBlob = true;
|
||||||
&dataPtr, &serLen, sizeof(buf), SerializeIF::Endianness::NETWORK) == returnvalue::OK);
|
CHECK(datasetLarge.serialize(&dataPtr, &serLen, sizeof(buf),
|
||||||
|
SerializeIF::Endianness::NETWORK) == returnvalue::OK);
|
||||||
CHECK(serLen == 32);
|
CHECK(serLen == 32);
|
||||||
CHECK(buf[30] == 0b11111111);
|
CHECK(buf[30] == 0b11111111);
|
||||||
CHECK(buf[31] == 0b10000000);
|
CHECK(buf[31] == 0b10000000);
|
||||||
|
@ -138,7 +138,7 @@ TEST_CASE("DataSetTest", "[datapool]") {
|
|||||||
|
|
||||||
SECTION("SharedDataSet") {
|
SECTION("SharedDataSet") {
|
||||||
object_id_t sharedSetId = objects::SHARED_SET_ID;
|
object_id_t sharedSetId = objects::SHARED_SET_ID;
|
||||||
SharedSet sharedSet(poolOwner.sharedPool, sharedSetId, 5);
|
SharedSet sharedSet(poolOwner.sharedPool, sharedSetId, 5, false);
|
||||||
localSet.localPoolVarUint8.setReadWriteMode(pool_rwm_t::VAR_WRITE);
|
localSet.localPoolVarUint8.setReadWriteMode(pool_rwm_t::VAR_WRITE);
|
||||||
localSet.localPoolUint16Vec.setReadWriteMode(pool_rwm_t::VAR_WRITE);
|
localSet.localPoolUint16Vec.setReadWriteMode(pool_rwm_t::VAR_WRITE);
|
||||||
CHECK(sharedSet.registerVariable(&localSet.localPoolVarUint8) == returnvalue::OK);
|
CHECK(sharedSet.registerVariable(&localSet.localPoolVarUint8) == returnvalue::OK);
|
||||||
@ -156,6 +156,7 @@ TEST_CASE("DataSetTest", "[datapool]") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SECTION("Serialize with Validity Blob") {
|
SECTION("Serialize with Validity Blob") {
|
||||||
|
localSet.serializeWithValidityBlob = true;
|
||||||
CHECK(!localSet.localPoolVarUint8.isValid());
|
CHECK(!localSet.localPoolVarUint8.isValid());
|
||||||
CHECK(!localSet.localPoolUint16Vec.isValid());
|
CHECK(!localSet.localPoolUint16Vec.isValid());
|
||||||
CHECK(!localSet.localPoolVarFloat.isValid());
|
CHECK(!localSet.localPoolVarFloat.isValid());
|
||||||
@ -169,6 +170,7 @@ TEST_CASE("DataSetTest", "[datapool]") {
|
|||||||
uint8_t* buffPtr = buffer;
|
uint8_t* buffPtr = buffer;
|
||||||
CHECK(localSet.serialize(&buffPtr, &serSize, sizeof(buffer),
|
CHECK(localSet.serialize(&buffPtr, &serSize, sizeof(buffer),
|
||||||
SerializeIF::Endianness::MACHINE) == returnvalue::OK);
|
SerializeIF::Endianness::MACHINE) == returnvalue::OK);
|
||||||
|
CHECK(serSize == 12);
|
||||||
CHECK(buffer[11] == 0b11100000);
|
CHECK(buffer[11] == 0b11100000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,9 +45,10 @@ class Dataset : public List {
|
|||||||
|
|
||||||
class StaticTestDataset : public StaticSharedSet<3> {
|
class StaticTestDataset : public StaticSharedSet<3> {
|
||||||
public:
|
public:
|
||||||
StaticTestDataset() : StaticSharedSet(lpool::testSid1) {}
|
StaticTestDataset() : StaticSharedSet(lpool::testSid1, false) {}
|
||||||
|
|
||||||
StaticTestDataset(SharedPool& sharedPool, uint32_t setId) : StaticSharedSet(sharedPool, setId) {}
|
StaticTestDataset(SharedPool& sharedPool, uint32_t setId)
|
||||||
|
: StaticSharedSet(sharedPool, setId, false) {}
|
||||||
|
|
||||||
u8_t localPoolVarUint8{lpool::uint8VarGpid, this};
|
u8_t localPoolVarUint8{lpool::uint8VarGpid, this};
|
||||||
f32_t localPoolVarFloat{lpool::floatVarGpid, this};
|
f32_t localPoolVarFloat{lpool::floatVarGpid, this};
|
||||||
@ -58,10 +59,10 @@ class StaticTestDataset : public StaticSharedSet<3> {
|
|||||||
|
|
||||||
class TestDataset : public SharedSet {
|
class TestDataset : public SharedSet {
|
||||||
public:
|
public:
|
||||||
TestDataset() : SharedSet(lpool::testSid2, lpool::dataSetMaxVariables) {}
|
TestDataset() : SharedSet(lpool::testSid2, lpool::dataSetMaxVariables, false) {}
|
||||||
|
|
||||||
TestDataset(SharedPool& sharedPool, uint32_t setId)
|
TestDataset(SharedPool& sharedPool, uint32_t setId)
|
||||||
: SharedSet(sharedPool, setId, lpool::dataSetMaxVariables) {}
|
: SharedSet(sharedPool, setId, lpool::dataSetMaxVariables, false) {}
|
||||||
|
|
||||||
u8_t localPoolVarUint8{lpool::uint8VarGpid, this};
|
u8_t localPoolVarUint8{lpool::uint8VarGpid, this};
|
||||||
f32_t localPoolVarFloat{lpool::floatVarGpid, this};
|
f32_t localPoolVarFloat{lpool::floatVarGpid, this};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user