1
0
forked from fsfw/fsfw

DataSetBase not bound to max size anymore

This commit is contained in:
2020-07-02 16:54:53 +02:00
parent 3e069c34aa
commit 099e6281ec
8 changed files with 58 additions and 15 deletions

View File

@ -1,8 +1,11 @@
#include <framework/datapool/DataSetBase.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
DataSetBase::DataSetBase() {
for (uint8_t count = 0; count < DATA_SET_MAX_SIZE; count++) {
DataSetBase::DataSetBase(PoolVariableIF** registeredVariablesArray,
const size_t maxFillCount):
registeredVariables(registeredVariablesArray),
maxFillCount(maxFillCount) {
for (uint8_t count = 0; count < maxFillCount; count++) {
registeredVariables[count] = nullptr;
}
}
@ -21,7 +24,7 @@ ReturnValue_t DataSetBase::registerVariable(
"Pool variable is nullptr." << std::endl;
return DataSetIF::POOL_VAR_NULL;
}
if (fillCount >= DATA_SET_MAX_SIZE) {
if (fillCount >= maxFillCount) {
sif::error << "DataSet::registerVariable: "
"DataSet is full." << std::endl;
return DataSetIF::DATA_SET_FULL;

View File

@ -37,7 +37,8 @@ public:
* supply a pointer to this dataset to PoolVariable
* initializations to register pool variables.
*/
DataSetBase();
DataSetBase(PoolVariableIF** registeredVariablesArray,
const size_t maxFillCount);
virtual~ DataSetBase();
/**
@ -110,11 +111,6 @@ public:
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
bool bigEndian) override;
// SHOULDDO we could use a linked list of datapool variables
//!< This definition sets the maximum number of variables to
//! register in one DataSet.
static const uint8_t DATA_SET_MAX_SIZE = 63;
protected:
/**
* @brief The fill_count attribute ensures that the variables
@ -137,8 +133,11 @@ protected:
/**
* @brief This array represents all pool variables registered in this set.
* Child classes can use a static or dynamic container to create
* an array of registered variables and assign the first entry here.
*/
PoolVariableIF* registeredVariables[DATA_SET_MAX_SIZE] = { };
PoolVariableIF** registeredVariables = nullptr;
const size_t maxFillCount = 0;
private:
ReturnValue_t readVariable(uint16_t count);