fsfw/datapool/PoolVariableIF.h

69 lines
2.2 KiB
C
Raw Permalink Normal View History

2020-09-06 15:23:38 +02:00
#ifndef FSFW_DATAPOOL_POOLVARIABLEIF_H_
#define FSFW_DATAPOOL_POOLVARIABLEIF_H_
2021-02-28 13:48:53 +01:00
#include "ReadCommitIF.h"
2020-08-13 20:53:35 +02:00
#include "../returnvalues/HasReturnvaluesIF.h"
#include "../serialize/SerializeIF.h"
2021-02-28 13:48:53 +01:00
/**
2020-09-06 15:23:38 +02:00
* @brief This interface is used to control data pool
* variable representations.
* @details
* To securely handle data pool variables, all pool entries are locally
* managed by data pool variable access classes, which are called pool
* variables. To ensure a common state of a set of variables needed in a
* function, these local pool variables again are managed by other classes,
* like the DataSet classes. This interface provides unified access to
* local pool variables for such manager classes.
* @author Bastian Baetz
* @ingroup data_pool
*/
2021-02-28 13:48:53 +01:00
class PoolVariableIF :
public SerializeIF,
public ReadCommitIF {
public:
2021-02-28 13:48:53 +01:00
static constexpr uint8_t INTERFACE_ID = CLASS_ID::POOL_VARIABLE_IF;
static constexpr ReturnValue_t INVALID_READ_WRITE_MODE = MAKE_RETURN_CODE(0xA0);
static constexpr ReturnValue_t INVALID_POOL_ENTRY = MAKE_RETURN_CODE(0xA1);
2020-09-06 15:23:38 +02:00
2021-02-28 13:48:53 +01:00
static constexpr bool VALID = 1;
static constexpr bool INVALID = 0;
static constexpr uint32_t NO_PARAMETER = 0xffffffff;
2020-09-06 15:23:38 +02:00
2021-02-28 13:48:53 +01:00
enum ReadWriteMode_t {
VAR_READ, VAR_WRITE, VAR_READ_WRITE
};
2021-02-28 13:48:53 +01:00
/**
* @brief This is an empty virtual destructor,
* as it is proposed for C++ interfaces.
*/
virtual ~PoolVariableIF() {}
/**
* @brief This method returns if the variable is write-only,
* read-write or read-only.
*/
virtual ReadWriteMode_t getReadWriteMode() const = 0;
virtual void setReadWriteMode(ReadWriteMode_t newMode) = 0;
2021-02-28 13:48:53 +01:00
/**
* @brief This operation shall return the data pool id of the variable.
*/
virtual uint32_t getDataPoolId() const = 0;
/**
* @brief With this call, the valid information of the
* variable is returned.
*/
virtual bool isValid() const = 0;
/**
* @brief With this call, the valid information of the variable is set.
*/
virtual void setValid(bool validity) = 0;
};
2020-09-06 15:23:38 +02:00
using pool_rwm_t = PoolVariableIF::ReadWriteMode_t;
#endif /* FSFW_DATAPOOL_POOLVARIABLEIF_H_ */