improved internal interface

This commit is contained in:
Robin Müller 2021-01-14 11:50:33 +01:00
parent 7bb570540b
commit 67ce8d2e24
7 changed files with 29 additions and 42 deletions

View File

@ -26,10 +26,6 @@ object_id_t ExtendedControllerBase::getObjectId() const {
return SystemObject::getObjectId();
}
AccessPoolManagerIF* ExtendedControllerBase::getAccessorHandle() {
return &poolManager;
}
uint32_t ExtendedControllerBase::getPeriodicOperationFrequency() const {
return this->executingTask->getPeriodMs();
}
@ -114,6 +110,6 @@ LocalPoolDataSetBase* ExtendedControllerBase::getDataSetHandle(sid_t sid) {
return nullptr;
}
ProvidesDataPoolSubscriptionIF* ExtendedControllerBase::getSubscriptionInterface() {
LocalDataPoolManager* ExtendedControllerBase::getHkManagerHandle() {
return &poolManager;
}

View File

@ -32,20 +32,10 @@ public:
virtual ReturnValue_t performOperation(uint8_t opCode) override;
virtual ReturnValue_t initializeAfterTaskCreation() override;
/**
* Provides a subscription interface for objects which required updates on changed
* controller variables or datasets
* @return
*/
ProvidesDataPoolSubscriptionIF* getSubscriptionInterface() override;
protected:
LocalDataPoolManager poolManager;
ActionHelper actionHelper;
//! Accessor handle required for internal handling
AccessPoolManagerIF* getAccessorHandle() override;
/**
* Implemented by child class. Handle all command messages which are
* not health, mode, action or housekeeping messages.
@ -68,6 +58,7 @@ protected:
size_t size) override;
/** HasLocalDatapoolIF overrides */
virtual LocalDataPoolManager* getHkManagerHandle() override;
virtual object_id_t getObjectId() const override;
virtual ReturnValue_t initializeLocalDataPool(
localpool::DataPool& localDataPoolMap,

View File

@ -2,6 +2,7 @@
#define FSFW_DATAPOOLLOCAL_HASLOCALDATAPOOLIF_H_
#include "localPoolDefinitions.h"
#include "LocalDataPoolManager.h"
#include "../datapool/PoolEntryIF.h"
#include "../serviceinterface/ServiceInterface.h"
@ -14,7 +15,6 @@ class AccessPoolManagerIF;
class ProvidesDataPoolSubscriptionIF;
class LocalPoolDataSetBase;
class LocalPoolObjectBase;
class LocalDataPoolManager;
/**
* @brief This interface is implemented by classes which posses a local data pool (not the
@ -104,19 +104,32 @@ public:
* which allows subscriptions to dataset and variable updates in form of messages.
* The consumers can then read the most recent variable value by calling read with
* an own pool variable or set instance or using the deserialized snapshot data.
* Returns the HK manager casted to the required interface by default.
* @return
*/
virtual ProvidesDataPoolSubscriptionIF* getSubscriptionInterface() = 0;
virtual ProvidesDataPoolSubscriptionIF* getSubscriptionInterface() {
return getHkManagerHandle();
}
protected:
/**
* Accessor handle required for internal handling. Not intended for users and therefore
* declared protected. Users should instead use pool variables, sets or the subscription
* interface to access pool entries.
* Every class implementing this interface should have a local data pool manager. This
* function will return a reference to the manager.
* @return
*/
virtual AccessPoolManagerIF* getAccessorHandle() = 0;
virtual LocalDataPoolManager* getHkManagerHandle() = 0;
/**
* Accessor handle required for internal handling. Not intended for users and therefore
* declared protected. Users should instead use pool variables, sets or the subscription
* interface to access pool entries. Returns the HK manager casted to a different interface
* by default.
* @return
*/
virtual AccessPoolManagerIF* getAccessorHandle() {
return getHkManagerHandle();
}
/**
* This function is used by the pool manager to get a valid dataset

View File

@ -1483,10 +1483,6 @@ void DeviceHandlerBase::setNormalDatapoolEntriesInvalid() {
}
}
AccessPoolManagerIF* DeviceHandlerBase::getAccessorHandle() {
return &poolManager;
}
void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType,
const char *functionName, ReturnValue_t errorCode,
const char *errorPrint) {
@ -1532,6 +1528,6 @@ void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType,
}
ProvidesDataPoolSubscriptionIF* DeviceHandlerBase::getSubscriptionInterface() {
LocalDataPoolManager* DeviceHandlerBase::getHkManagerHandle() {
return &poolManager;
}

View File

@ -518,14 +518,10 @@ protected:
LocalDataPoolManager& poolManager) override;
/**
* Provides the subscription handle which can be used by classes like controllers
* to get messages on data updates.
* Required for HasLocalDataPoolIF, return a handle to the local pool manager.
* @return
*/
ProvidesDataPoolSubscriptionIF* getSubscriptionInterface() override;
//! Accessor handle required for internal handling.
AccessPoolManagerIF* getAccessorHandle() override;
LocalDataPoolManager* getHkManagerHandle() override;
/**
* @brief Hook function for child handlers which is called once per

View File

@ -139,10 +139,6 @@ uint32_t InternalErrorReporter::getStoreHits() {
return value;
}
AccessPoolManagerIF* InternalErrorReporter::getAccessorHandle() {
return &poolManager;
}
void InternalErrorReporter::incrementStoreHits() {
mutex->lockMutex(timeoutType, timeoutMs);
storeHits++;
@ -201,6 +197,6 @@ void InternalErrorReporter::setMutexTimeout(MutexIF::TimeoutType timeoutType,
this->timeoutMs = timeoutMs;
}
ProvidesDataPoolSubscriptionIF* InternalErrorReporter::getSubscriptionInterface() {
LocalDataPoolManager* InternalErrorReporter::getHkManagerHandle() {
return &poolManager;
}

View File

@ -45,8 +45,7 @@ public:
LocalDataPoolManager& poolManager) override;
virtual dur_millis_t getPeriodicOperationFrequency() const override;
virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
ProvidesDataPoolSubscriptionIF* getSubscriptionInterface() override;
AccessPoolManagerIF* getAccessorHandle() override;
LocalDataPoolManager* getHkManagerHandle() override;
virtual ReturnValue_t initialize() override;
virtual ReturnValue_t initializeAfterTaskCreation() override;