fsfw/datapoollocal/LocalPoolObjectBase.cpp

82 lines
2.4 KiB
C++
Raw Normal View History

2020-12-03 13:00:04 +01:00
#include "LocalPoolObjectBase.h"
LocalPoolObjectBase::LocalPoolObjectBase(lp_id_t poolId,
HasLocalDataPoolIF* hkOwner, DataSetIF* dataSet,
pool_rwm_t setReadWriteMode): localPoolId(poolId),
readWriteMode(setReadWriteMode) {
if(poolId == PoolVariableIF::NO_PARAMETER) {
2021-01-03 14:16:52 +01:00
#if FSFW_CPP_OSTREAM_ENABLED == 1
2020-12-03 13:00:04 +01:00
sif::warning << "LocalPoolVar<T>::LocalPoolVar: 0 passed as pool ID, "
<< "which is the NO_PARAMETER value!" << std::endl;
#endif
2020-12-03 13:00:04 +01:00
}
if(hkOwner == nullptr) {
2021-01-03 14:16:52 +01:00
#if FSFW_CPP_OSTREAM_ENABLED == 1
2020-12-03 13:00:04 +01:00
sif::error << "LocalPoolVar<T>::LocalPoolVar: The supplied pool "
<< "owner is a invalid!" << std::endl;
#endif
2020-12-03 13:00:04 +01:00
return;
}
hkManager = hkOwner->getHkManagerHandle();
if (dataSet != nullptr) {
dataSet->registerVariable(this);
}
}
LocalPoolObjectBase::LocalPoolObjectBase(object_id_t poolOwner, lp_id_t poolId,
DataSetIF *dataSet, pool_rwm_t setReadWriteMode): localPoolId(poolId),
readWriteMode(setReadWriteMode) {
if(poolId == PoolVariableIF::NO_PARAMETER) {
2021-01-03 14:16:52 +01:00
#if FSFW_CPP_OSTREAM_ENABLED == 1
2020-12-03 13:00:04 +01:00
sif::warning << "LocalPoolVar<T>::LocalPoolVar: 0 passed as pool ID, "
<< "which is the NO_PARAMETER value!" << std::endl;
#endif
2020-12-03 13:00:04 +01:00
}
HasLocalDataPoolIF* hkOwner =
objectManager->get<HasLocalDataPoolIF>(poolOwner);
if(hkOwner == nullptr) {
2021-01-03 14:16:52 +01:00
#if FSFW_CPP_OSTREAM_ENABLED == 1
2020-12-03 13:00:04 +01:00
sif::error << "LocalPoolVariable: The supplied pool owner did not "
<< "implement the correct interface"
<< " HasLocalDataPoolIF!" << std::endl;
#endif
2020-12-03 13:00:04 +01:00
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;
}
void LocalPoolObjectBase::setReadWriteMode(pool_rwm_t newReadWriteMode) {
this->readWriteMode = newReadWriteMode;
}