base class extraction complete
This commit is contained in:
parent
72ca2bfa43
commit
9ca086e026
@ -88,9 +88,8 @@ ReturnValue_t LocalDataPoolManager::initializeHousekeepingPoolEntriesOnce() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t LocalDataPoolManager::performHkOperation() {
|
ReturnValue_t LocalDataPoolManager::performHkOperation() {
|
||||||
|
ReturnValue_t status = HasReturnvaluesIF::RETURN_OK;
|
||||||
for(auto& receiver: hkReceiversMap) {
|
for(auto& receiver: hkReceiversMap) {
|
||||||
//HkReceiver* receiver = &hkReceiversIter.second;
|
|
||||||
|
|
||||||
switch(receiver.reportingType) {
|
switch(receiver.reportingType) {
|
||||||
case(ReportingType::PERIODIC): {
|
case(ReportingType::PERIODIC): {
|
||||||
if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) {
|
if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) {
|
||||||
@ -100,8 +99,46 @@ ReturnValue_t LocalDataPoolManager::performHkOperation() {
|
|||||||
performPeriodicHkGeneration(receiver);
|
performPeriodicHkGeneration(receiver);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case(ReportingType::UPDATE_HK): {
|
||||||
|
if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) {
|
||||||
|
// Periodic packets shall only be generated from datasets.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(
|
||||||
|
receiver.dataId.sid);
|
||||||
|
if(dataSet->hasChanged()) {
|
||||||
|
// prepare and send update notification
|
||||||
|
ReturnValue_t result = generateHousekeepingPacket(
|
||||||
|
receiver.dataId.sid, dataSet, true);
|
||||||
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
status = result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(ReportingType::UPDATE_NOTIFICATION): {
|
||||||
|
if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) {
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(
|
||||||
|
receiver.dataId.sid);
|
||||||
|
if(dataSet->hasChanged()) {
|
||||||
|
// prepare and send update notification
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case(ReportingType::UPDATE_SNAPSHOT): {
|
case(ReportingType::UPDATE_SNAPSHOT): {
|
||||||
// check whether data has changed and send messages in case it has.
|
// check whether data has changed and send messages in case it has.
|
||||||
|
if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) {
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(
|
||||||
|
receiver.dataId.sid);
|
||||||
|
if(dataSet->hasChanged()) {
|
||||||
|
// prepare and send update snapshot.
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -109,7 +146,7 @@ ReturnValue_t LocalDataPoolManager::performHkOperation() {
|
|||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t LocalDataPoolManager::subscribeForPeriodicPacket(sid_t sid,
|
ReturnValue_t LocalDataPoolManager::subscribeForPeriodicPacket(sid_t sid,
|
||||||
@ -368,8 +405,7 @@ ReturnValue_t LocalDataPoolManager::changeCollectionInterval(sid_t sid,
|
|||||||
ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid,
|
ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid,
|
||||||
bool isDiagnostics) {
|
bool isDiagnostics) {
|
||||||
// Get and check dataset first.
|
// Get and check dataset first.
|
||||||
LocalPoolDataSetBase* dataSet = dynamic_cast<LocalPoolDataSetBase*>(
|
LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(sid);
|
||||||
owner->getDataSetHandle(sid));
|
|
||||||
if(dataSet == nullptr) {
|
if(dataSet == nullptr) {
|
||||||
sif::warning << "HousekeepingManager::generateHousekeepingPacket:"
|
sif::warning << "HousekeepingManager::generateHousekeepingPacket:"
|
||||||
<< " Set ID not found" << std::endl;
|
<< " Set ID not found" << std::endl;
|
||||||
|
@ -226,7 +226,7 @@ void LocalPoolDataSetBase::setChanged(bool changed) {
|
|||||||
this->changed = changed;
|
this->changed = changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LocalPoolDataSetBase::isChanged() const {
|
bool LocalPoolDataSetBase::hasChanged() const {
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ public:
|
|||||||
bool isValid() const override;
|
bool isValid() const override;
|
||||||
|
|
||||||
void setChanged(bool changed);
|
void setChanged(bool changed);
|
||||||
bool isChanged() const;
|
bool hasChanged() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
sid_t sid;
|
sid_t sid;
|
||||||
|
67
datapoollocal/LocalPoolObjectBase.cpp
Normal file
67
datapoollocal/LocalPoolObjectBase.cpp
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
#include "LocalPoolObjectBase.h"
|
||||||
|
|
||||||
|
LocalPoolObjectBase::LocalPoolObjectBase(lp_id_t poolId,
|
||||||
|
HasLocalDataPoolIF* hkOwner, DataSetIF* dataSet,
|
||||||
|
pool_rwm_t setReadWriteMode) {
|
||||||
|
if(poolId == PoolVariableIF::NO_PARAMETER) {
|
||||||
|
sif::warning << "LocalPoolVar<T>::LocalPoolVar: 0 passed as pool ID, "
|
||||||
|
<< "which is the NO_PARAMETER value!" << std::endl;
|
||||||
|
}
|
||||||
|
if(hkOwner == nullptr) {
|
||||||
|
sif::error << "LocalPoolVar<T>::LocalPoolVar: The supplied pool "
|
||||||
|
<< "owner is a invalid!" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
hkManager = hkOwner->getHkManagerHandle();
|
||||||
|
if (dataSet != nullptr) {
|
||||||
|
dataSet->registerVariable(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LocalPoolObjectBase::LocalPoolObjectBase(lp_id_t poolId, object_id_t poolOwner,
|
||||||
|
DataSetIF *dataSet, pool_rwm_t setReadWriteMode) {
|
||||||
|
if(poolId == PoolVariableIF::NO_PARAMETER) {
|
||||||
|
sif::warning << "LocalPoolVar<T>::LocalPoolVar: 0 passed as pool ID, "
|
||||||
|
<< "which is the NO_PARAMETER value!" << std::endl;
|
||||||
|
}
|
||||||
|
HasLocalDataPoolIF* hkOwner =
|
||||||
|
objectManager->get<HasLocalDataPoolIF>(poolOwner);
|
||||||
|
if(hkOwner == nullptr) {
|
||||||
|
sif::error << "LocalPoolVariable: The supplied pool owner did not "
|
||||||
|
<< "implement the correct interface"
|
||||||
|
<< " HasLocalDataPoolIF!" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
hkManager = hkOwner->getHkManagerHandle();
|
||||||
|
if(dataSet != nullptr) {
|
||||||
|
dataSet->registerVariable(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pool_rwm_t LocalPoolObjectBase::getReadWriteMode() const {
|
||||||
|
return readWriteMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LocalPoolObjectBase::isValid() const {
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LocalPoolObjectBase::setValid(bool valid) {
|
||||||
|
this->valid = valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
lp_id_t LocalPoolObjectBase::getDataPoolId() const {
|
||||||
|
return localPoolId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LocalPoolObjectBase::setDataPoolId(lp_id_t poolId) {
|
||||||
|
this->localPoolId = poolId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LocalPoolObjectBase::setChanged(bool changed) {
|
||||||
|
this->changed = changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LocalPoolObjectBase::hasChanged() const {
|
||||||
|
return changed;
|
||||||
|
}
|
58
datapoollocal/LocalPoolObjectBase.h
Normal file
58
datapoollocal/LocalPoolObjectBase.h
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
#ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLOBJECTBASE_H_
|
||||||
|
#define FSFW_DATAPOOLLOCAL_LOCALPOOLOBJECTBASE_H_
|
||||||
|
|
||||||
|
#include "../datapoollocal/LocalDataPoolManager.h"
|
||||||
|
#include "../datapool/PoolVariableIF.h"
|
||||||
|
|
||||||
|
class LocalPoolObjectBase: public PoolVariableIF, HasReturnvaluesIF {
|
||||||
|
public:
|
||||||
|
LocalPoolObjectBase(lp_id_t poolId,
|
||||||
|
HasLocalDataPoolIF* hkOwner, DataSetIF* dataSet,
|
||||||
|
pool_rwm_t setReadWriteMode);
|
||||||
|
|
||||||
|
LocalPoolObjectBase(lp_id_t poolId, object_id_t poolOwner,
|
||||||
|
DataSetIF* dataSet = nullptr,
|
||||||
|
pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE);
|
||||||
|
|
||||||
|
pool_rwm_t getReadWriteMode() const;
|
||||||
|
|
||||||
|
bool isValid() const override;
|
||||||
|
void setValid(bool valid) override;
|
||||||
|
|
||||||
|
void setChanged(bool changed);
|
||||||
|
bool hasChanged() const;
|
||||||
|
|
||||||
|
lp_id_t getDataPoolId() const override;
|
||||||
|
void setDataPoolId(lp_id_t poolId);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* @brief To access the correct data pool entry on read and commit calls,
|
||||||
|
* the data pool id is stored.
|
||||||
|
*/
|
||||||
|
uint32_t localPoolId = PoolVariableIF::NO_PARAMETER;
|
||||||
|
/**
|
||||||
|
* @brief The valid information as it was stored in the data pool
|
||||||
|
* is copied to this attribute.
|
||||||
|
*/
|
||||||
|
bool valid = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief A local pool variable can be marked as changed.
|
||||||
|
*/
|
||||||
|
bool changed = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The information whether the class is read-write or
|
||||||
|
* read-only is stored here.
|
||||||
|
*/
|
||||||
|
ReadWriteMode_t readWriteMode = pool_rwm_t::VAR_READ_WRITE;
|
||||||
|
|
||||||
|
//! @brief Pointer to the class which manages the HK pool.
|
||||||
|
LocalDataPoolManager* hkManager;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* FSFW_DATAPOOLLOCAL_LOCALPOOLOBJECTBASE_H_ */
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLVARIABLE_H_
|
#ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLVARIABLE_H_
|
||||||
#define FSFW_DATAPOOLLOCAL_LOCALPOOLVARIABLE_H_
|
#define FSFW_DATAPOOLLOCAL_LOCALPOOLVARIABLE_H_
|
||||||
|
|
||||||
|
#include "LocalPoolObjectBase.h"
|
||||||
#include "HasLocalDataPoolIF.h"
|
#include "HasLocalDataPoolIF.h"
|
||||||
#include "LocalDataPoolManager.h"
|
#include "LocalDataPoolManager.h"
|
||||||
|
|
||||||
@ -21,7 +22,7 @@
|
|||||||
* @ingroup data_pool
|
* @ingroup data_pool
|
||||||
*/
|
*/
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class LocalPoolVar: public PoolVariableIF, HasReturnvaluesIF {
|
class LocalPoolVar: public LocalPoolObjectBase {
|
||||||
public:
|
public:
|
||||||
//! Default ctor is forbidden.
|
//! Default ctor is forbidden.
|
||||||
LocalPoolVar() = delete;
|
LocalPoolVar() = delete;
|
||||||
@ -76,15 +77,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
T value = 0;
|
T value = 0;
|
||||||
|
|
||||||
pool_rwm_t getReadWriteMode() const override;
|
|
||||||
|
|
||||||
lp_id_t getDataPoolId() const override;
|
|
||||||
void setDataPoolId(lp_id_t poolId);
|
|
||||||
|
|
||||||
bool isValid() const override;
|
|
||||||
void setValid(bool validity) override;
|
|
||||||
uint8_t getValid() const;
|
|
||||||
|
|
||||||
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
||||||
SerializeIF::Endianness streamEndianness) const override;
|
SerializeIF::Endianness streamEndianness) const override;
|
||||||
virtual size_t getSerializedSize() const override;
|
virtual size_t getSerializedSize() const override;
|
||||||
@ -145,15 +137,6 @@ protected:
|
|||||||
const LocalPoolVar<U> &var);
|
const LocalPoolVar<U> &var);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! @brief Pool ID of pool entry inside the used local pool.
|
|
||||||
lp_id_t localPoolId = PoolVariableIF::NO_PARAMETER;
|
|
||||||
//! @brief Read-write mode of the pool variable
|
|
||||||
pool_rwm_t readWriteMode = pool_rwm_t::VAR_READ_WRITE;
|
|
||||||
//! @brief Specifies whether the entry is valid or invalid.
|
|
||||||
bool valid = false;
|
|
||||||
|
|
||||||
//! Pointer to the class which manages the HK pool.
|
|
||||||
LocalDataPoolManager* hkManager;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "LocalPoolVariable.tpp"
|
#include "LocalPoolVariable.tpp"
|
||||||
|
@ -9,43 +9,12 @@ template<typename T>
|
|||||||
inline LocalPoolVar<T>::LocalPoolVar(lp_id_t poolId,
|
inline LocalPoolVar<T>::LocalPoolVar(lp_id_t poolId,
|
||||||
HasLocalDataPoolIF* hkOwner, DataSetIF* dataSet,
|
HasLocalDataPoolIF* hkOwner, DataSetIF* dataSet,
|
||||||
pool_rwm_t setReadWriteMode):
|
pool_rwm_t setReadWriteMode):
|
||||||
localPoolId(poolId), readWriteMode(setReadWriteMode) {
|
LocalPoolObjectBase(poolId, hkOwner, dataSet, setReadWriteMode) {}
|
||||||
if(poolId == PoolVariableIF::NO_PARAMETER) {
|
|
||||||
sif::warning << "LocalPoolVar<T>::LocalPoolVar: 0 passed as pool ID, "
|
|
||||||
<< "which is the NO_PARAMETER value!" << std::endl;
|
|
||||||
}
|
|
||||||
if(hkOwner == nullptr) {
|
|
||||||
sif::error << "LocalPoolVar<T>::LocalPoolVar: The supplied pool "
|
|
||||||
<< "owner is a invalid!" << std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
hkManager = hkOwner->getHkManagerHandle();
|
|
||||||
if(dataSet != nullptr) {
|
|
||||||
dataSet->registerVariable(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline LocalPoolVar<T>::LocalPoolVar(lp_id_t poolId, object_id_t poolOwner,
|
inline LocalPoolVar<T>::LocalPoolVar(lp_id_t poolId, object_id_t poolOwner,
|
||||||
DataSetIF *dataSet, pool_rwm_t setReadWriteMode):
|
DataSetIF *dataSet, pool_rwm_t setReadWriteMode):
|
||||||
localPoolId(poolId), readWriteMode(setReadWriteMode) {
|
LocalPoolObjectBase(poolId, poolOwner, dataSet, setReadWriteMode) {}
|
||||||
if(poolId == PoolVariableIF::NO_PARAMETER) {
|
|
||||||
sif::warning << "LocalPoolVar<T>::LocalPoolVar: 0 passed as pool ID, "
|
|
||||||
<< "which is the NO_PARAMETER value!" << std::endl;
|
|
||||||
}
|
|
||||||
HasLocalDataPoolIF* hkOwner =
|
|
||||||
objectManager->get<HasLocalDataPoolIF>(poolOwner);
|
|
||||||
if(hkOwner == nullptr) {
|
|
||||||
sif::error << "LocalPoolVariable: The supplied pool owner did not "
|
|
||||||
<< "implement the correct interface "
|
|
||||||
<< "HasLocalDataPoolIF!" << std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
hkManager = hkOwner->getHkManagerHandle();
|
|
||||||
if(dataSet != nullptr) {
|
|
||||||
dataSet->registerVariable(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline ReturnValue_t LocalPoolVar<T>::read(dur_millis_t lockTimeout) {
|
inline ReturnValue_t LocalPoolVar<T>::read(dur_millis_t lockTimeout) {
|
||||||
@ -111,36 +80,6 @@ inline LocalPoolVar<T> & LocalPoolVar<T>::operator =(T newValue) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
inline pool_rwm_t LocalPoolVar<T>::getReadWriteMode() const {
|
|
||||||
return readWriteMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
inline lp_id_t LocalPoolVar<T>::getDataPoolId() const {
|
|
||||||
return localPoolId;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
inline void LocalPoolVar<T>::setDataPoolId(lp_id_t poolId) {
|
|
||||||
this->localPoolId = poolId;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
inline bool LocalPoolVar<T>::isValid() const {
|
|
||||||
return valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
inline void LocalPoolVar<T>::setValid(bool validity) {
|
|
||||||
this->valid = validity;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
inline uint8_t LocalPoolVar<T>::getValid() const {
|
|
||||||
return valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline ReturnValue_t LocalPoolVar<T>::serialize(uint8_t** buffer, size_t* size,
|
inline ReturnValue_t LocalPoolVar<T>::serialize(uint8_t** buffer, size_t* size,
|
||||||
const size_t max_size, SerializeIF::Endianness streamEndianness) const {
|
const size_t max_size, SerializeIF::Endianness streamEndianness) const {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef FRAMEWORK_DATAPOOLLOCAL_LOCALPOOLVECTOR_H_
|
#ifndef FRAMEWORK_DATAPOOLLOCAL_LOCALPOOLVECTOR_H_
|
||||||
#define FRAMEWORK_DATAPOOLLOCAL_LOCALPOOLVECTOR_H_
|
#define FRAMEWORK_DATAPOOLLOCAL_LOCALPOOLVECTOR_H_
|
||||||
|
|
||||||
|
#include "LocalPoolObjectBase.h"
|
||||||
#include "../datapool/DataSetIF.h"
|
#include "../datapool/DataSetIF.h"
|
||||||
#include "../datapool/PoolEntry.h"
|
#include "../datapool/PoolEntry.h"
|
||||||
#include "../datapool/PoolVariableIF.h"
|
#include "../datapool/PoolVariableIF.h"
|
||||||
@ -30,7 +31,7 @@
|
|||||||
* @ingroup data_pool
|
* @ingroup data_pool
|
||||||
*/
|
*/
|
||||||
template<typename T, uint16_t vectorSize>
|
template<typename T, uint16_t vectorSize>
|
||||||
class LocalPoolVector: public PoolVariableIF, public HasReturnvaluesIF {
|
class LocalPoolVector: public LocalPoolObjectBase {
|
||||||
public:
|
public:
|
||||||
LocalPoolVector() = delete;
|
LocalPoolVector() = delete;
|
||||||
/**
|
/**
|
||||||
@ -48,8 +49,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
LocalPoolVector(lp_id_t poolId, HasLocalDataPoolIF* hkOwner,
|
LocalPoolVector(lp_id_t poolId, HasLocalDataPoolIF* hkOwner,
|
||||||
DataSetIF* dataSet = nullptr,
|
DataSetIF* dataSet = nullptr,
|
||||||
pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE
|
pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE);
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This constructor is used by data users like controllers to have
|
* This constructor is used by data users like controllers to have
|
||||||
@ -67,8 +67,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
LocalPoolVector(lp_id_t poolId, object_id_t poolOwner,
|
LocalPoolVector(lp_id_t poolId, object_id_t poolOwner,
|
||||||
DataSetIF* dataSet = nullptr,
|
DataSetIF* dataSet = nullptr,
|
||||||
pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE
|
pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE);
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is the local copy of the data pool entry.
|
* @brief This is the local copy of the data pool entry.
|
||||||
@ -91,27 +90,6 @@ public:
|
|||||||
return vectorSize;
|
return vectorSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t getDataPoolId() const override;
|
|
||||||
/**
|
|
||||||
* @brief This operation sets the data pool ID of the variable.
|
|
||||||
* @details
|
|
||||||
* The method is necessary to set id's of data pool member variables
|
|
||||||
* with bad initialization.
|
|
||||||
*/
|
|
||||||
void setDataPoolId(uint32_t poolId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method returns if the variable is write-only, read-write or read-only.
|
|
||||||
*/
|
|
||||||
pool_rwm_t getReadWriteMode() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief With this call, the valid information of the variable is returned.
|
|
||||||
*/
|
|
||||||
bool isValid() const override;
|
|
||||||
void setValid(bool valid) override;
|
|
||||||
uint8_t getValid() const;
|
|
||||||
|
|
||||||
T& operator [](int i);
|
T& operator [](int i);
|
||||||
const T &operator [](int i) const;
|
const T &operator [](int i) const;
|
||||||
|
|
||||||
@ -168,23 +146,7 @@ protected:
|
|||||||
ReturnValue_t commitWithoutLock() override;
|
ReturnValue_t commitWithoutLock() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
|
||||||
* @brief To access the correct data pool entry on read and commit calls,
|
|
||||||
* the data pool id is stored.
|
|
||||||
*/
|
|
||||||
uint32_t localPoolId;
|
|
||||||
/**
|
|
||||||
* @brief The valid information as it was stored in the data pool
|
|
||||||
* is copied to this attribute.
|
|
||||||
*/
|
|
||||||
bool valid;
|
|
||||||
/**
|
|
||||||
* @brief The information whether the class is read-write or
|
|
||||||
* read-only is stored here.
|
|
||||||
*/
|
|
||||||
ReadWriteMode_t readWriteMode;
|
|
||||||
//! @brief Pointer to the class which manages the HK pool.
|
|
||||||
LocalDataPoolManager* hkManager;
|
|
||||||
|
|
||||||
// std::ostream is the type for object std::cout
|
// std::ostream is the type for object std::cout
|
||||||
template <typename U, uint16_t otherSize>
|
template <typename U, uint16_t otherSize>
|
||||||
|
@ -9,39 +9,12 @@ template<typename T, uint16_t vectorSize>
|
|||||||
inline LocalPoolVector<T, vectorSize>::LocalPoolVector(lp_id_t poolId,
|
inline LocalPoolVector<T, vectorSize>::LocalPoolVector(lp_id_t poolId,
|
||||||
HasLocalDataPoolIF* hkOwner, DataSetIF* dataSet,
|
HasLocalDataPoolIF* hkOwner, DataSetIF* dataSet,
|
||||||
pool_rwm_t setReadWriteMode):
|
pool_rwm_t setReadWriteMode):
|
||||||
localPoolId(poolId), valid(false), readWriteMode(setReadWriteMode) {
|
LocalPoolObjectBase(poolId, hkOwner, dataSet, setReadWriteMode) {}
|
||||||
if(poolId == PoolVariableIF::NO_PARAMETER) {
|
|
||||||
sif::warning << "LocalPoolVector: PoolVariableIF::NO_PARAMETER passed "
|
|
||||||
<< "as pool ID, which is the NO_PARAMETER value!" << std::endl;
|
|
||||||
}
|
|
||||||
std::memset(this->value, 0, vectorSize * sizeof(T));
|
|
||||||
hkManager = hkOwner->getHkManagerHandle();
|
|
||||||
if (dataSet != nullptr) {
|
|
||||||
dataSet->registerVariable(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
template<typename T, uint16_t vectorSize>
|
||||||
inline LocalPoolVector<T, vectorSize>::LocalPoolVector(lp_id_t poolId,
|
inline LocalPoolVector<T, vectorSize>::LocalPoolVector(lp_id_t poolId,
|
||||||
object_id_t poolOwner, DataSetIF *dataSet, pool_rwm_t setReadWriteMode):
|
object_id_t poolOwner, DataSetIF *dataSet, pool_rwm_t setReadWriteMode):
|
||||||
readWriteMode(setReadWriteMode) {
|
LocalPoolObjectBase(poolId, poolOwner, dataSet, setReadWriteMode) {}
|
||||||
if(poolId == PoolVariableIF::NO_PARAMETER) {
|
|
||||||
sif::warning << "LocalPoolVector: PoolVariableIF::NO_PARAMETER passed "
|
|
||||||
<< "as pool ID, which is the NO_PARAMETER value!" << std::endl;
|
|
||||||
}
|
|
||||||
HasLocalDataPoolIF* hkOwner =
|
|
||||||
objectManager->get<HasLocalDataPoolIF>(poolOwner);
|
|
||||||
if(hkOwner == nullptr) {
|
|
||||||
sif::error << "LocalPoolVariable: The supplied pool owner did not "
|
|
||||||
<< "implement the correct interface HasHkPoolParametersIF!"
|
|
||||||
<< std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
hkManager = hkOwner->getHkManagerHandle();
|
|
||||||
if(dataSet != nullptr) {
|
|
||||||
dataSet->registerVariable(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
template<typename T, uint16_t vectorSize>
|
||||||
inline ReturnValue_t LocalPoolVector<T, vectorSize>::read(uint32_t lockTimeout) {
|
inline ReturnValue_t LocalPoolVector<T, vectorSize>::read(uint32_t lockTimeout) {
|
||||||
@ -161,37 +134,6 @@ inline ReturnValue_t LocalPoolVector<T, vectorSize>::deSerialize(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
|
||||||
inline pool_rwm_t LocalPoolVector<T, vectorSize>::getReadWriteMode() const {
|
|
||||||
return this->readWriteMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
|
||||||
inline uint32_t LocalPoolVector<T, vectorSize>::getDataPoolId() const {
|
|
||||||
return localPoolId;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
|
||||||
inline void LocalPoolVector<T, vectorSize>::setDataPoolId(uint32_t poolId) {
|
|
||||||
this->localPoolId = poolId;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
|
||||||
inline void LocalPoolVector<T, vectorSize>::setValid(bool valid) {
|
|
||||||
this->valid = valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
|
||||||
inline uint8_t LocalPoolVector<T, vectorSize>::getValid() const {
|
|
||||||
return valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
|
||||||
inline bool LocalPoolVector<T, vectorSize>::isValid() const {
|
|
||||||
return valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
template<typename T, uint16_t vectorSize>
|
||||||
inline std::ostream& operator<< (std::ostream &out,
|
inline std::ostream& operator<< (std::ostream &out,
|
||||||
const LocalPoolVector<T, vectorSize> &var) {
|
const LocalPoolVector<T, vectorSize> &var) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user