its all falling into places

This commit is contained in:
Robin Müller 2020-10-14 01:38:27 +02:00
parent 9ca086e026
commit 45c0acec5f
2 changed files with 38 additions and 1 deletions

View File

@ -11,6 +11,7 @@
class LocalDataPoolManager; class LocalDataPoolManager;
class LocalPoolDataSetBase; class LocalPoolDataSetBase;
class LocalPoolObjectBase;
using LocalDataPool = std::map<lp_id_t, PoolEntryIF*>; using LocalDataPool = std::map<lp_id_t, PoolEntryIF*>;
using LocalDataPoolMapIter = LocalDataPool::iterator; using LocalDataPoolMapIter = LocalDataPool::iterator;
@ -76,6 +77,19 @@ public:
*/ */
virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) = 0; virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) = 0;
/**
* Similar to the function above, but used to get a local pool variable
* handle. This is only needed for update notifications, so it is not
* defined as abstract.
* @param localPoolId
* @return
*/
virtual LocalPoolObjectBase* getPoolObjectHandle(lp_id_t localPoolId) {
sif::warning << "HasLocalDataPoolIF::getPoolObjectHandle: Not overriden"
<< ". Returning nullptr!" << std::endl;
return nullptr;
}
/** /**
* @brief This function will be called by the manager if an update * @brief This function will be called by the manager if an update
* notification is received. * notification is received.

View File

@ -1,4 +1,5 @@
#include "LocalDataPoolManager.h" #include "LocalDataPoolManager.h"
#include "LocalPoolObjectBase.h"
#include "LocalPoolDataSetBase.h" #include "LocalPoolDataSetBase.h"
#include "../housekeeping/HousekeepingSetPacket.h" #include "../housekeeping/HousekeepingSetPacket.h"
@ -101,7 +102,7 @@ ReturnValue_t LocalDataPoolManager::performHkOperation() {
} }
case(ReportingType::UPDATE_HK): { case(ReportingType::UPDATE_HK): {
if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) { if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) {
// Periodic packets shall only be generated from datasets. // Update packets shall only be generated from datasets.
continue; continue;
} }
LocalPoolDataSetBase* dataSet = owner->getDataSetHandle( LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(
@ -118,10 +119,21 @@ ReturnValue_t LocalDataPoolManager::performHkOperation() {
} }
case(ReportingType::UPDATE_NOTIFICATION): { case(ReportingType::UPDATE_NOTIFICATION): {
if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) { if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) {
LocalPoolObjectBase* poolObj = owner->getPoolObjectHandle(
receiver.dataId.localPoolId);
if(poolObj == nullptr) {
continue;
}
if(poolObj->hasChanged()) {
// prepare and send update notification.
}
} }
else { else {
LocalPoolDataSetBase* dataSet = owner->getDataSetHandle( LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(
receiver.dataId.sid); receiver.dataId.sid);
if(dataSet == nullptr) {
continue;
}
if(dataSet->hasChanged()) { if(dataSet->hasChanged()) {
// prepare and send update notification // prepare and send update notification
} }
@ -131,10 +143,21 @@ ReturnValue_t LocalDataPoolManager::performHkOperation() {
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) { if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) {
LocalPoolObjectBase* poolObj = owner->getPoolObjectHandle(
receiver.dataId.localPoolId);
if(poolObj == nullptr) {
continue;
}
if(poolObj->hasChanged()) {
// prepare and send update snapshot.
}
} }
else { else {
LocalPoolDataSetBase* dataSet = owner->getDataSetHandle( LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(
receiver.dataId.sid); receiver.dataId.sid);
if(dataSet == nullptr) {
continue;
}
if(dataSet->hasChanged()) { if(dataSet->hasChanged()) {
// prepare and send update snapshot. // prepare and send update snapshot.
} }