fsfw/src/fsfw/datapool/PoolVarList.h

29 lines
849 B
C
Raw Normal View History

2020-09-06 15:23:38 +02:00
#ifndef FSFW_DATAPOOL_POOLVARLIST_H_
#define FSFW_DATAPOOL_POOLVARLIST_H_
2020-09-06 15:23:38 +02:00
#include "../datapool/PoolVariableIF.h"
#include "../datapoolglob/GlobalPoolVariable.h"
template <class T, uint8_t n_var>
class PoolVarList {
2022-02-02 10:29:30 +01:00
private:
GlobPoolVar<T> variables[n_var];
2022-02-02 10:29:30 +01:00
public:
PoolVarList(const uint32_t set_id[n_var], DataSetIF* dataSet,
PoolVariableIF::ReadWriteMode_t setReadWriteMode) {
// I really should have a look at the new init list c++ syntax.
if (dataSet == NULL) {
return;
}
for (uint8_t count = 0; count < n_var; count++) {
variables[count].dataPoolId = set_id[count];
variables[count].readWriteMode = setReadWriteMode;
dataSet->registerVariable(&variables[count]);
}
}
2022-02-02 10:29:30 +01:00
GlobPoolVar<T>& operator[](int i) { return variables[i]; }
};
2020-09-06 15:23:38 +02:00
#endif /* FSFW_DATAPOOL_POOLVARLIST_H_ */