From 25f08b8c1f8143bbcabfab7f40541351eb2adc50 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 30 Nov 2020 13:59:54 +0100 Subject: [PATCH] started replacing local pool vars --- datapoollocal/LocalPoolObjectBase.cpp | 2 +- datapoollocal/LocalPoolObjectBase.h | 2 +- datapoollocal/LocalPoolVariable.h | 11 +++++++++-- datapoollocal/LocalPoolVariable.tpp | 12 ++++++++++-- datapoollocal/LocalPoolVector.h | 18 ++++++++++++++---- datapoollocal/LocalPoolVector.tpp | 21 ++++++++++++++------- thermal/ThermalComponentCore.cpp | 7 +++---- thermal/ThermalComponentCore.h | 19 ++++++++++--------- 8 files changed, 62 insertions(+), 30 deletions(-) diff --git a/datapoollocal/LocalPoolObjectBase.cpp b/datapoollocal/LocalPoolObjectBase.cpp index 88027169..c25df25a 100644 --- a/datapoollocal/LocalPoolObjectBase.cpp +++ b/datapoollocal/LocalPoolObjectBase.cpp @@ -19,7 +19,7 @@ LocalPoolObjectBase::LocalPoolObjectBase(lp_id_t poolId, } } -LocalPoolObjectBase::LocalPoolObjectBase(lp_id_t poolId, object_id_t poolOwner, +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) { diff --git a/datapoollocal/LocalPoolObjectBase.h b/datapoollocal/LocalPoolObjectBase.h index 4d25b88a..8d1ab45e 100644 --- a/datapoollocal/LocalPoolObjectBase.h +++ b/datapoollocal/LocalPoolObjectBase.h @@ -14,7 +14,7 @@ public: HasLocalDataPoolIF* hkOwner, DataSetIF* dataSet, pool_rwm_t setReadWriteMode); - LocalPoolObjectBase(lp_id_t poolId, object_id_t poolOwner, + LocalPoolObjectBase(object_id_t poolOwner, lp_id_t poolId, DataSetIF* dataSet = nullptr, pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE); diff --git a/datapoollocal/LocalPoolVariable.h b/datapoollocal/LocalPoolVariable.h index e9d94178..85d86420 100644 --- a/datapoollocal/LocalPoolVariable.h +++ b/datapoollocal/LocalPoolVariable.h @@ -64,9 +64,17 @@ public: * @param setReadWriteMode Specify the read-write mode of the pool variable. * */ - LocalPoolVar(lp_id_t poolId, object_id_t poolOwner, + LocalPoolVar(object_id_t poolOwner, lp_id_t poolId, DataSetIF* dataSet = nullptr, pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE); + /** + * Variation which takes the global unique identifier of a pool variable. + * @param globalPoolId + * @param dataSet + * @param setReadWriteMode + */ + LocalPoolVar(gp_id_t globalPoolId, DataSetIF* dataSet = nullptr, + pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE); virtual~ LocalPoolVar() {}; @@ -156,5 +164,4 @@ using lp_int64_t = LocalPoolVar; using lp_float_t = LocalPoolVar; using lp_double_t = LocalPoolVar; - #endif /* FSFW_DATAPOOLLOCAL_LOCALPOOLVARIABLE_H_ */ diff --git a/datapoollocal/LocalPoolVariable.tpp b/datapoollocal/LocalPoolVariable.tpp index 3320aa5a..7025e462 100644 --- a/datapoollocal/LocalPoolVariable.tpp +++ b/datapoollocal/LocalPoolVariable.tpp @@ -12,9 +12,17 @@ inline LocalPoolVar::LocalPoolVar(lp_id_t poolId, LocalPoolObjectBase(poolId, hkOwner, dataSet, setReadWriteMode) {} template -inline LocalPoolVar::LocalPoolVar(lp_id_t poolId, object_id_t poolOwner, +inline LocalPoolVar::LocalPoolVar(object_id_t poolOwner, lp_id_t poolId, DataSetIF *dataSet, pool_rwm_t setReadWriteMode): - LocalPoolObjectBase(poolId, poolOwner, dataSet, setReadWriteMode) {} + LocalPoolObjectBase(poolOwner, poolId, dataSet, setReadWriteMode) {} + + +template +inline LocalPoolVar::LocalPoolVar(gp_id_t globalPoolId, DataSetIF *dataSet, + pool_rwm_t setReadWriteMode): + LocalPoolObjectBase(globalPoolId.objectId, globalPoolId.localPoolId, + dataSet, setReadWriteMode){} + template inline ReturnValue_t LocalPoolVar::read(dur_millis_t lockTimeout) { diff --git a/datapoollocal/LocalPoolVector.h b/datapoollocal/LocalPoolVector.h index a7ebd3fe..4644b748 100644 --- a/datapoollocal/LocalPoolVector.h +++ b/datapoollocal/LocalPoolVector.h @@ -1,5 +1,5 @@ -#ifndef FRAMEWORK_DATAPOOLLOCAL_LOCALPOOLVECTOR_H_ -#define FRAMEWORK_DATAPOOLLOCAL_LOCALPOOLVECTOR_H_ +#ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLVECTOR_H_ +#define FSFW_DATAPOOLLOCAL_LOCALPOOLVECTOR_H_ #include "LocalPoolObjectBase.h" #include "../datapool/DataSetIF.h" @@ -65,7 +65,17 @@ public: * @param dataSet The data set in which the variable shall register itself. * If nullptr, the variable is not registered. */ - LocalPoolVector(lp_id_t poolId, object_id_t poolOwner, + LocalPoolVector(object_id_t poolOwner, lp_id_t poolId, + DataSetIF* dataSet = nullptr, + pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE); + /** + * Variation which takes the unique global identifier of a local pool + * vector. + * @param globalPoolId + * @param dataSet + * @param setReadWriteMode + */ + LocalPoolVector(gp_id_t globalPoolId, DataSetIF* dataSet = nullptr, pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE); @@ -161,4 +171,4 @@ private: template using lp_vec_t = LocalPoolVector; -#endif /* FRAMEWORK_DATAPOOLLOCAL_LOCALPOOLVECTOR_H_ */ +#endif /* FSFW_DATAPOOLLOCAL_LOCALPOOLVECTOR_H_ */ diff --git a/datapoollocal/LocalPoolVector.tpp b/datapoollocal/LocalPoolVector.tpp index 34720b97..fc3c0a2e 100644 --- a/datapoollocal/LocalPoolVector.tpp +++ b/datapoollocal/LocalPoolVector.tpp @@ -1,7 +1,7 @@ -#ifndef FRAMEWORK_DATAPOOLLOCAL_LOCALPOOLVECTOR_TPP_ -#define FRAMEWORK_DATAPOOLLOCAL_LOCALPOOLVECTOR_TPP_ +#ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLVECTOR_TPP_ +#define FSFW_DATAPOOLLOCAL_LOCALPOOLVECTOR_TPP_ -#ifndef FRAMEWORK_DATAPOOLLOCAL_LOCALPOOLVECTOR_H_ +#ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLVECTOR_H_ #error Include LocalPoolVector.h before LocalPoolVector.tpp! #endif @@ -12,9 +12,16 @@ inline LocalPoolVector::LocalPoolVector(lp_id_t poolId, LocalPoolObjectBase(poolId, hkOwner, dataSet, setReadWriteMode) {} template -inline LocalPoolVector::LocalPoolVector(lp_id_t poolId, - object_id_t poolOwner, DataSetIF *dataSet, pool_rwm_t setReadWriteMode): - LocalPoolObjectBase(poolId, poolOwner, dataSet, setReadWriteMode) {} +inline LocalPoolVector::LocalPoolVector(object_id_t poolOwner, + lp_id_t poolId, DataSetIF *dataSet, pool_rwm_t setReadWriteMode): + LocalPoolObjectBase(poolOwner, poolId, dataSet, setReadWriteMode) {} + + +template +inline LocalPoolVector::LocalPoolVector(gp_id_t globalPoolId, + DataSetIF *dataSet, pool_rwm_t setReadWriteMode): + LocalPoolObjectBase(globalPoolId.objectId, globalPoolId.localPoolId, + dataSet, setReadWriteMode) {} template inline ReturnValue_t LocalPoolVector::read(uint32_t lockTimeout) { @@ -148,4 +155,4 @@ inline std::ostream& operator<< (std::ostream &out, return out; } -#endif +#endif /* FSFW_DATAPOOLLOCAL_LOCALPOOLVECTOR_TPP_ */ diff --git a/thermal/ThermalComponentCore.cpp b/thermal/ThermalComponentCore.cpp index bf28f307..07649bf3 100644 --- a/thermal/ThermalComponentCore.cpp +++ b/thermal/ThermalComponentCore.cpp @@ -1,10 +1,9 @@ #include "ThermalComponentCore.h" ThermalComponentCore::ThermalComponentCore(object_id_t reportingObjectId, - uint8_t domainId, uint32_t temperaturePoolId, - uint32_t targetStatePoolId, - uint32_t currentStatePoolId, uint32_t requestPoolId, - GlobDataSet* dataSet, Parameters parameters, + uint8_t domainId, gp_id_t temperaturePoolId, + gp_id_t targetStatePoolId, gp_id_t currentStatePoolId, + gp_id_t requestPoolId, LocalDataSetBase* dataSet, Parameters parameters, StateRequest initialTargetState) : temperature(temperaturePoolId, dataSet, PoolVariableIF::VAR_WRITE), targetState(targetStatePoolId, dataSet, PoolVariableIF::VAR_READ), diff --git a/thermal/ThermalComponentCore.h b/thermal/ThermalComponentCore.h index 2d08ed1d..49ca098e 100644 --- a/thermal/ThermalComponentCore.h +++ b/thermal/ThermalComponentCore.h @@ -6,8 +6,9 @@ #include "AbstractTemperatureSensor.h" #include "ThermalModule.h" -#include "../datapoolglob/GlobalDataSet.h" -#include "../datapoolglob/GlobalPoolVariable.h" +//#include "../datapoolglob/GlobalDataSet.h" +//#include "../datapoolglob/GlobalPoolVariable.h" +#include "../datapoollocal/LocalPoolVariable.h" /** * @brief @@ -38,9 +39,9 @@ public: * @param initialTargetState */ ThermalComponentCore(object_id_t reportingObjectId, uint8_t domainId, - uint32_t temperaturePoolId, uint32_t targetStatePoolId, - uint32_t currentStatePoolId, uint32_t requestPoolId, - GlobDataSet *dataSet, Parameters parameters, + gp_id_t temperaturePoolId, gp_id_t targetStatePoolId, + gp_id_t currentStatePoolId, gp_id_t requestPoolId, + LocalDataSetBase* dataSet, Parameters parameters, StateRequest initialTargetState = ThermalComponentIF::STATE_REQUEST_OPERATIONAL); @@ -80,10 +81,10 @@ protected: AbstractTemperatureSensor *secondRedundantSensor = nullptr; ThermalModuleIF *thermalModule = nullptr; - gp_float_t temperature; - gp_int8_t targetState; - gp_int8_t currentState; - gp_uint8_t heaterRequest; + lp_var_t temperature; + lp_var_t targetState; + lp_var_t currentState; + lp_var_t heaterRequest; bool isHeating = false;