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 LocalPoolDataSetBase;
class LocalPoolObjectBase;
using LocalDataPool = std::map<lp_id_t, PoolEntryIF*>;
using LocalDataPoolMapIter = LocalDataPool::iterator;
@ -76,6 +77,19 @@ public:
*/
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
* notification is received.

View File

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