new functions to set all vars read only
This commit is contained in:
parent
043d47e5e4
commit
35825a6561
@ -46,6 +46,8 @@ public:
|
|||||||
* read-write or read-only.
|
* read-write or read-only.
|
||||||
*/
|
*/
|
||||||
virtual ReadWriteMode_t getReadWriteMode() const = 0;
|
virtual ReadWriteMode_t getReadWriteMode() const = 0;
|
||||||
|
virtual void setReadWriteMode(ReadWriteMode_t newMode) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This operation shall return the data pool id of the variable.
|
* @brief This operation shall return the data pool id of the variable.
|
||||||
*/
|
*/
|
||||||
@ -59,7 +61,6 @@ public:
|
|||||||
* @brief With this call, the valid information of the variable is set.
|
* @brief With this call, the valid information of the variable is set.
|
||||||
*/
|
*/
|
||||||
virtual void setValid(bool validity) = 0;
|
virtual void setValid(bool validity) = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
using pool_rwm_t = PoolVariableIF::ReadWriteMode_t;
|
using pool_rwm_t = PoolVariableIF::ReadWriteMode_t;
|
||||||
|
@ -301,3 +301,8 @@ object_id_t LocalPoolDataSetBase::getCreatorObjectId() {
|
|||||||
return objects::NO_OBJECT;
|
return objects::NO_OBJECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LocalPoolDataSetBase::setAllVariablesReadOnly() {
|
||||||
|
for(size_t idx = 0; idx < this->getFillCount(); idx++) {
|
||||||
|
registeredVariables[idx]->setReadWriteMode(pool_rwm_t::VAR_READ);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -109,6 +109,12 @@ public:
|
|||||||
LocalPoolDataSetBase(const LocalPoolDataSetBase& otherSet) = delete;
|
LocalPoolDataSetBase(const LocalPoolDataSetBase& otherSet) = delete;
|
||||||
const LocalPoolDataSetBase& operator=(const LocalPoolDataSetBase& otherSet) = delete;
|
const LocalPoolDataSetBase& operator=(const LocalPoolDataSetBase& otherSet) = delete;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper functions used to set all currently contained variables to read-only.
|
||||||
|
* It is recommended to call this in set constructors intended to be used
|
||||||
|
* by data consumers to prevent accidentally changing pool data.
|
||||||
|
*/
|
||||||
|
void setAllVariablesReadOnly();
|
||||||
void setValidityBufferGeneration(bool withValidityBuffer);
|
void setValidityBufferGeneration(bool withValidityBuffer);
|
||||||
|
|
||||||
sid_t getSid() const;
|
sid_t getSid() const;
|
||||||
|
@ -1,3 +1,29 @@
|
|||||||
## Local Data Pools
|
## Local Data Pools
|
||||||
|
|
||||||
|
The local data pools can be used to store data like sensor values so they can be used
|
||||||
|
by other software objects like controllers as well. If a class should have a local pool which
|
||||||
|
can be used by other software objects as well, following steps have to be performed:
|
||||||
|
|
||||||
|
1. Create a `LocalDataPoolManager` member class
|
||||||
|
2. Implement the `HasLocalDataPoolIF`
|
||||||
|
|
||||||
|
The local data pool manager is also able to process housekeeping service requests in form
|
||||||
|
of messages, generate periodic housekeeping packet, generate notification and snapshots of changed
|
||||||
|
variables and datasets and process notifications and snapshots coming from other objects.
|
||||||
|
Two important framework classes already perform the two steps shown above so the steps required
|
||||||
|
are altered slightly.
|
||||||
|
|
||||||
|
### Storing and Accessing pool data
|
||||||
|
|
||||||
|
The pool manager is responsible for thread-safe access of the pool data, but the actual
|
||||||
|
access to the pool data is done via proxy classes like pool variable classes or dataset classes.
|
||||||
|
Generally, a user will create a dataset class which in turn groups all cohesive pool variables.
|
||||||
|
|
||||||
|
The user can then use this set class to `read` the variables and `commit` changed variables
|
||||||
|
back into the pool.
|
||||||
|
|
||||||
|
### Using the local data pools of the `DeviceHandlerBase`
|
||||||
|
|
||||||
|
It is very common to store data generated by devices like a sensor into a pool which can
|
||||||
|
then be used by other objects. Therefore, the `DeviceHandlerBase` already has a
|
||||||
|
local pool. The
|
||||||
|
Loading…
Reference in New Issue
Block a user