improved documentation signigicantly
This commit is contained in:
83
datapoollocal/LocalDataPoolManager.cpp
Normal file
83
datapoollocal/LocalDataPoolManager.cpp
Normal file
@ -0,0 +1,83 @@
|
||||
#include <framework/datapoollocal/LocalDataPoolManager.h>
|
||||
#include <framework/datapoollocal/LocalDataSet.h>
|
||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
||||
#include <framework/ipc/MutexFactory.h>
|
||||
#include <framework/ipc/MutexHelper.h>
|
||||
|
||||
#include <array>
|
||||
|
||||
LocalDataPoolManager::LocalDataPoolManager(OwnsLocalDataPoolIF* owner) {
|
||||
if(owner == nullptr) {
|
||||
sif::error << "HkManager: Invalid supplied owner!" << std::endl;
|
||||
std::exit(0);
|
||||
}
|
||||
this->owner = owner;
|
||||
mutex = MutexFactory::instance()->createMutex();
|
||||
//owner->setMinimalHkSamplingFrequency();
|
||||
}
|
||||
|
||||
LocalDataPoolManager::~LocalDataPoolManager() {}
|
||||
|
||||
ReturnValue_t LocalDataPoolManager::initializeHousekeepingPoolEntriesOnce() {
|
||||
if(not mapInitialized) {
|
||||
ReturnValue_t result =
|
||||
owner->initializeHousekeepingPoolEntries(localDpMap);
|
||||
if(result == HasReturnvaluesIF::RETURN_OK) {
|
||||
mapInitialized = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
sif::warning << "HousekeepingManager: The map" << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage(
|
||||
CommandMessage *message) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t LocalDataPoolManager::printPoolEntry(
|
||||
lp_id_t localPoolId) {
|
||||
auto poolIter = localDpMap.find(localPoolId);
|
||||
if (poolIter == localDpMap.end()) {
|
||||
sif::debug << "HousekeepingManager::fechPoolEntry:"
|
||||
" Pool entry not found." << std::endl;
|
||||
return OwnsLocalDataPoolIF::POOL_ENTRY_NOT_FOUND;
|
||||
}
|
||||
poolIter->second->print();
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
MutexIF* LocalDataPoolManager::getMutexHandle() {
|
||||
return mutex;
|
||||
}
|
||||
|
||||
//void HousekeepingManager::setMinimalSamplingFrequency(float frequencySeconds) {
|
||||
// this->samplingFrequency = frequencySeconds;
|
||||
//
|
||||
//}
|
||||
|
||||
void LocalDataPoolManager::generateHousekeepingPacket(sid_t sid) {
|
||||
LocalDataSet* dataSetToSerialize = dynamic_cast<LocalDataSet*>(
|
||||
owner->getDataSetHandle(sid));
|
||||
if(dataSetToSerialize == nullptr) {
|
||||
sif::warning << "HousekeepingManager::generateHousekeepingPacket:"
|
||||
" Set ID not found" << std::endl;
|
||||
return;
|
||||
}
|
||||
std::array<uint8_t, 256> testBuffer = {};
|
||||
uint8_t* dataPtr = testBuffer.data();
|
||||
size_t size = 0;
|
||||
dataSetToSerialize->serialize(&dataPtr, &size, testBuffer.size(),
|
||||
false);
|
||||
// and now we send it to the TM funnel or somewhere else
|
||||
|
||||
}
|
||||
|
||||
void LocalDataPoolManager::setHkPacketQueue(MessageQueueIF *msgQueue) {
|
||||
this->hkPacketQueue = msgQueue;
|
||||
}
|
||||
|
||||
const OwnsLocalDataPoolIF* LocalDataPoolManager::getOwner() const {
|
||||
return owner;
|
||||
}
|
131
datapoollocal/LocalDataPoolManager.h
Normal file
131
datapoollocal/LocalDataPoolManager.h
Normal file
@ -0,0 +1,131 @@
|
||||
#ifndef FRAMEWORK_HK_HOUSEKEEPINGHELPER_H_
|
||||
#define FRAMEWORK_HK_HOUSEKEEPINGHELPER_H_
|
||||
#include <framework/datapool/DataSetIF.h>
|
||||
#include <framework/objectmanager/SystemObjectIF.h>
|
||||
#include <framework/ipc/MutexIF.h>
|
||||
|
||||
#include <framework/housekeeping/HousekeepingMessage.h>
|
||||
#include <framework/datapool/PoolEntry.h>
|
||||
#include <framework/datapoollocal/OwnsLocalDataPoolIF.h>
|
||||
#include <framework/ipc/CommandMessage.h>
|
||||
#include <framework/ipc/MessageQueueIF.h>
|
||||
#include <framework/ipc/MutexHelper.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
/**
|
||||
* @brief This class is the managing instance for local data pool.
|
||||
* @details
|
||||
* The actual data pool structure is a member of this class. Any class which
|
||||
* has a local data pool shall have this class as a member and implement
|
||||
* the OwnsLocalDataPoolIF.
|
||||
*
|
||||
* Users of the data pool use the helper classes LocalDataSet,
|
||||
* LocalPoolVariable and LocalPoolVector to access pool entries in
|
||||
* a thread-safe and efficient way.
|
||||
*
|
||||
* The local data pools employ a blackboard logic: Only the most recent
|
||||
* value is stored. The helper classes offer a read() and commit() interface
|
||||
* through the PoolVariableIF which is used to read and update values.
|
||||
* Each pool entry has a valid state too.
|
||||
*
|
||||
*/
|
||||
class LocalDataPoolManager {
|
||||
template<typename T>
|
||||
friend class LocalPoolVar;
|
||||
template<typename T, uint16_t vecSize>
|
||||
friend class LocalPoolVector;
|
||||
friend class LocalDataSet;
|
||||
public:
|
||||
static constexpr float MINIMAL_SAMPLING_FREQUENCY = 0.2;
|
||||
|
||||
LocalDataPoolManager(OwnsLocalDataPoolIF* owner);
|
||||
virtual~ LocalDataPoolManager();
|
||||
|
||||
|
||||
// propably will just call respective local data set functions.
|
||||
void generateHousekeepingPacket(sid_t sid);
|
||||
ReturnValue_t handleHousekeepingMessage(CommandMessage* message);
|
||||
|
||||
/**
|
||||
* This function is used to fill the local data pool map with pool
|
||||
* entries. It should only be called once by the pool owner.
|
||||
* @param localDataPoolMap
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t initializeHousekeepingPoolEntriesOnce();
|
||||
|
||||
void setHkPacketQueue(MessageQueueIF* msgQueue);
|
||||
const OwnsLocalDataPoolIF* getOwner() const;
|
||||
|
||||
ReturnValue_t printPoolEntry(lp_id_t localPoolId);
|
||||
|
||||
private:
|
||||
//! This is the map holding the actual data. Should only be initialized
|
||||
//! once !
|
||||
bool mapInitialized = false;
|
||||
LocalDataPool localDpMap;
|
||||
|
||||
//! Every housekeeping data manager has a mutex to protect access
|
||||
//! to it's data pool.
|
||||
MutexIF * mutex = nullptr;
|
||||
|
||||
//! The class which actually owns the manager (and its datapool).
|
||||
OwnsLocalDataPoolIF* owner = nullptr;
|
||||
|
||||
//! Used for replies.
|
||||
//! (maybe we dont need this, the sender can be retrieved from command
|
||||
//! message..)
|
||||
MessageQueueIF* hkReplyQueue = nullptr;
|
||||
//! Used for HK packets, which are generated without requests.
|
||||
//! Maybe this will just be the TM funnel.
|
||||
MessageQueueIF* hkPacketQueue = nullptr;
|
||||
|
||||
/**
|
||||
* Get the pointer to the mutex. Can be used to lock the data pool
|
||||
* eternally. Use with care and don't forget to unlock locked mutexes!
|
||||
* For now, only friend classes can accss this function.
|
||||
* @return
|
||||
*/
|
||||
MutexIF* getMutexHandle();
|
||||
|
||||
/**
|
||||
* Read a variable by supplying its local pool ID and assign the pool
|
||||
* entry to the supplied PoolEntry pointer. The type of the pool entry
|
||||
* is deduced automatically. This call is not thread-safe!
|
||||
* For now, only friend classes like LocalPoolVar may access this
|
||||
* function.
|
||||
* @tparam T Type of the pool entry
|
||||
* @param localPoolId Pool ID of the variable to read
|
||||
* @param poolVar [out] Corresponding pool entry will be assigned to the
|
||||
* supplied pointer.
|
||||
* @return
|
||||
*/
|
||||
template <class T> ReturnValue_t fetchPoolEntry(lp_id_t localPoolId,
|
||||
PoolEntry<T> **poolEntry);
|
||||
|
||||
void setMinimalSamplingFrequency(float frequencySeconds);
|
||||
};
|
||||
|
||||
|
||||
template<class T> inline
|
||||
ReturnValue_t LocalDataPoolManager::fetchPoolEntry(lp_id_t localPoolId,
|
||||
PoolEntry<T> **poolEntry) {
|
||||
auto poolIter = localDpMap.find(localPoolId);
|
||||
if (poolIter == localDpMap.end()) {
|
||||
sif::debug << "HousekeepingManager::fechPoolEntry:"
|
||||
" Pool entry not found." << std::endl;
|
||||
return OwnsLocalDataPoolIF::POOL_ENTRY_NOT_FOUND;
|
||||
}
|
||||
|
||||
*poolEntry = dynamic_cast< PoolEntry<T>* >(poolIter->second);
|
||||
if(*poolEntry == nullptr) {
|
||||
sif::debug << "HousekeepingManager::fetchPoolEntry:"
|
||||
" Pool entry not found." << std::endl;
|
||||
return OwnsLocalDataPoolIF::POOL_ENTRY_TYPE_CONFLICT;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
|
||||
#endif /* FRAMEWORK_HK_HOUSEKEEPINGHELPER_H_ */
|
@ -1,7 +1,7 @@
|
||||
#include <framework/datapoollocal/LocalDataPoolManager.h>
|
||||
#include <framework/datapoollocal/LocalDataSet.h>
|
||||
#include <framework/housekeeping/HousekeepingManager.h>
|
||||
|
||||
LocalDataSet::LocalDataSet(HasHkPoolParametersIF *hkOwner): DataSetBase() {
|
||||
LocalDataSet::LocalDataSet(OwnsLocalDataPoolIF *hkOwner): DataSetBase() {
|
||||
if(hkOwner != nullptr) {
|
||||
hkManager = hkOwner->getHkManagerHandle();
|
||||
}
|
||||
@ -11,7 +11,7 @@ LocalDataSet::LocalDataSet(HasHkPoolParametersIF *hkOwner): DataSetBase() {
|
||||
}
|
||||
|
||||
LocalDataSet::LocalDataSet(object_id_t ownerId): DataSetBase() {
|
||||
HasHkPoolParametersIF* hkOwner = objectManager->get<HasHkPoolParametersIF>(
|
||||
OwnsLocalDataPoolIF* hkOwner = objectManager->get<OwnsLocalDataPoolIF>(
|
||||
ownerId);
|
||||
if(hkOwner == nullptr) {
|
||||
// config error, error output here.
|
||||
|
@ -2,10 +2,10 @@
|
||||
#define FRAMEWORK_DATAPOOLLOCAL_LOCALDATASET_H_
|
||||
#include <framework/datapool/DataSetBase.h>
|
||||
#include <framework/datapool/DataSetIF.h>
|
||||
#include <framework/housekeeping/HasHkPoolParametersIF.h>
|
||||
#include <framework/datapoollocal/OwnsLocalDataPoolIF.h>
|
||||
#include <framework/serialize/SerializeIF.h>
|
||||
|
||||
class HousekeepingManager;
|
||||
class LocalDataPoolManager;
|
||||
|
||||
/**
|
||||
* @brief The LocalDataSet class manages a set of locally checked out variables
|
||||
@ -35,7 +35,7 @@ public:
|
||||
* The constructor simply sets the fill_count to zero and sets
|
||||
* the state to "uninitialized".
|
||||
*/
|
||||
LocalDataSet(HasHkPoolParametersIF* hkOwner);
|
||||
LocalDataSet(OwnsLocalDataPoolIF* hkOwner);
|
||||
|
||||
/**
|
||||
* @brief Constructor for users of local pool data. The passed pool
|
||||
@ -78,7 +78,7 @@ private:
|
||||
*/
|
||||
ReturnValue_t unlockDataPool() override;
|
||||
|
||||
HousekeepingManager* hkManager;
|
||||
LocalDataPoolManager* hkManager;
|
||||
};
|
||||
|
||||
#endif /* FRAMEWORK_DATAPOOLLOCAL_LOCALDATASET_H_ */
|
||||
|
@ -3,11 +3,11 @@
|
||||
|
||||
#include <framework/datapool/PoolVariableIF.h>
|
||||
#include <framework/datapool/DataSetIF.h>
|
||||
#include <framework/housekeeping/HasHkPoolParametersIF.h>
|
||||
#include <framework/datapoollocal/LocalDataPoolManager.h>
|
||||
#include <framework/datapoollocal/OwnsLocalDataPoolIF.h>
|
||||
#include <framework/objectmanager/ObjectManagerIF.h>
|
||||
|
||||
#include <framework/serialize/SerializeAdapter.h>
|
||||
#include <framework/housekeeping/HousekeepingManager.h>
|
||||
|
||||
/**
|
||||
* @brief Local Pool Variable class which is used to access the local pools.
|
||||
@ -29,9 +29,12 @@ public:
|
||||
/**
|
||||
* This constructor is used by the data creators to have pool variable
|
||||
* instances which can also be stored in datasets.
|
||||
* It does not fetch the current value from the data pool. This is performed
|
||||
* by the read() operation (which is not thread-safe).
|
||||
* Datasets can be used to access local pool entires in a thread-safe way.
|
||||
*
|
||||
* It does not fetch the current value from the data pool, which
|
||||
* has to be done by calling the read() operation.
|
||||
* Datasets can be used to access multiple local pool entries in an
|
||||
* efficient way. A pointer to a dataset can be passed to register
|
||||
* the pool variable in that dataset directly.
|
||||
* @param poolId ID of the local pool entry.
|
||||
* @param hkOwner Pointer of the owner. This will generally be the calling
|
||||
* class itself which passes "this".
|
||||
@ -39,7 +42,7 @@ public:
|
||||
* @param dataSet The data set in which the variable shall register itself.
|
||||
* If nullptr, the variable is not registered.
|
||||
*/
|
||||
LocalPoolVar(lp_id_t poolId, HasHkPoolParametersIF* hkOwner,
|
||||
LocalPoolVar(lp_id_t poolId, OwnsLocalDataPoolIF* hkOwner,
|
||||
pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE,
|
||||
DataSetIF* dataSet = nullptr);
|
||||
|
||||
@ -47,12 +50,14 @@ public:
|
||||
* This constructor is used by data users like controllers to have
|
||||
* access to the local pool variables of data creators by supplying
|
||||
* the respective creator object ID.
|
||||
* It does not fetch the current value from the data pool. This is performed
|
||||
* by the read() operation (which is not thread-safe).
|
||||
* Datasets can be used to access local pool entires in a thread-safe way.
|
||||
*
|
||||
* It does not fetch the current value from the data pool, which
|
||||
* has to be done by calling the read() operation.
|
||||
* Datasets can be used to access multiple local pool entries in an
|
||||
* efficient way. A pointer to a dataset can be passed to register
|
||||
* the pool variable in that dataset directly.
|
||||
* @param poolId ID of the local pool entry.
|
||||
* @param hkOwner Pointer of the owner. This will generally be the calling
|
||||
* class itself which passes "this".
|
||||
* @param hkOwner object ID of the pool owner.
|
||||
* @param setReadWriteMode Specify the read-write mode of the pool variable.
|
||||
* @param dataSet The data set in which the variable shall register itself.
|
||||
* If nullptr, the variable is not registered.
|
||||
@ -99,7 +104,7 @@ public:
|
||||
* at once to avoid the overhead of unnecessary lock und unlock operations.
|
||||
*
|
||||
*/
|
||||
ReturnValue_t read(uint32_t lockTimeout = MutexIF::BLOCKING) override;
|
||||
ReturnValue_t read(dur_millis_t lockTimeout = MutexIF::BLOCKING) override;
|
||||
/**
|
||||
* @brief The commit call copies the array values back to the data pool.
|
||||
* @details
|
||||
@ -109,7 +114,8 @@ public:
|
||||
* It is recommended to use DataSets to read and commit multiple variables
|
||||
* at once to avoid the overhead of unnecessary lock und unlock operations.
|
||||
*/
|
||||
ReturnValue_t commit(uint32_t lockTimeout = MutexIF::BLOCKING) override;
|
||||
ReturnValue_t commit(dur_millis_t lockTimeout = MutexIF::BLOCKING) override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief Like #read, but without a lock protection of the global pool.
|
||||
@ -144,7 +150,7 @@ private:
|
||||
bool valid = false;
|
||||
|
||||
//! Pointer to the class which manages the HK pool.
|
||||
HousekeepingManager* hkManager;
|
||||
LocalDataPoolManager* hkManager;
|
||||
};
|
||||
|
||||
#include <framework/datapoollocal/LocalPoolVariable.tpp>
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
template<typename T>
|
||||
inline LocalPoolVar<T>::LocalPoolVar(lp_id_t poolId,
|
||||
HasHkPoolParametersIF* hkOwner, pool_rwm_t setReadWriteMode,
|
||||
OwnsLocalDataPoolIF* hkOwner, pool_rwm_t setReadWriteMode,
|
||||
DataSetIF* dataSet):
|
||||
localPoolId(poolId),readWriteMode(setReadWriteMode) {
|
||||
if(poolId == PoolVariableIF::NO_PARAMETER) {
|
||||
@ -33,8 +33,8 @@ inline LocalPoolVar<T>::LocalPoolVar(lp_id_t poolId, object_id_t poolOwner,
|
||||
sif::warning << "LocalPoolVector: 0 passed as pool ID, which is the "
|
||||
"NO_PARAMETER value!" << std::endl;
|
||||
}
|
||||
HasHkPoolParametersIF* hkOwner =
|
||||
objectManager->get<HasHkPoolParametersIF>(poolOwner);
|
||||
OwnsLocalDataPoolIF* hkOwner =
|
||||
objectManager->get<OwnsLocalDataPoolIF>(poolOwner);
|
||||
if(hkOwner == nullptr) {
|
||||
sif::error << "LocalPoolVariable: The supplied pool owner did not implement"
|
||||
"the correct interface HasHkPoolParametersIF!" << std::endl;
|
||||
@ -47,7 +47,7 @@ inline LocalPoolVar<T>::LocalPoolVar(lp_id_t poolId, object_id_t poolOwner,
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline ReturnValue_t LocalPoolVar<T>::read(millis_t lockTimeout) {
|
||||
inline ReturnValue_t LocalPoolVar<T>::read(dur_millis_t lockTimeout) {
|
||||
MutexHelper(hkManager->getMutexHandle(), lockTimeout);
|
||||
return readWithoutLock();
|
||||
}
|
||||
@ -75,7 +75,7 @@ inline ReturnValue_t LocalPoolVar<T>::readWithoutLock() {
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline ReturnValue_t LocalPoolVar<T>::commit(millis_t lockTimeout) {
|
||||
inline ReturnValue_t LocalPoolVar<T>::commit(dur_millis_t lockTimeout) {
|
||||
MutexHelper(hkManager->getMutexHandle(), lockTimeout);
|
||||
return commitWithoutLock();
|
||||
}
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include <framework/datapool/DataSetIF.h>
|
||||
#include <framework/datapool/PoolEntry.h>
|
||||
#include <framework/datapool/PoolVariableIF.h>
|
||||
#include <framework/datapoollocal/LocalDataPoolManager.h>
|
||||
#include <framework/serialize/SerializeAdapter.h>
|
||||
#include <framework/housekeeping/HousekeepingManager.h>
|
||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ 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, HasHkPoolParametersIF* hkOwner,
|
||||
LocalPoolVector(lp_id_t poolId, OwnsLocalDataPoolIF* hkOwner,
|
||||
pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE,
|
||||
DataSetIF* dataSet = nullptr);
|
||||
|
||||
@ -179,7 +179,7 @@ private:
|
||||
*/
|
||||
ReadWriteMode_t readWriteMode;
|
||||
//! @brief Pointer to the class which manages the HK pool.
|
||||
HousekeepingManager* hkManager;
|
||||
LocalDataPoolManager* hkManager;
|
||||
|
||||
// std::ostream is the type for object std::cout
|
||||
template <typename U, uint16_t otherSize>
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
template<typename T, uint16_t vectorSize>
|
||||
inline LocalPoolVector<T, vectorSize>::LocalPoolVector(lp_id_t poolId,
|
||||
HasHkPoolParametersIF* hkOwner, pool_rwm_t setReadWriteMode,
|
||||
OwnsLocalDataPoolIF* hkOwner, pool_rwm_t setReadWriteMode,
|
||||
DataSetIF* dataSet) :
|
||||
localPoolId(poolId), valid(false), readWriteMode(setReadWriteMode) {
|
||||
if(poolId == PoolVariableIF::NO_PARAMETER) {
|
||||
@ -29,8 +29,8 @@ inline LocalPoolVector<T, vectorSize>::LocalPoolVector(lp_id_t poolId,
|
||||
sif::warning << "LocalPoolVector: 0 passed as pool ID, which is the "
|
||||
"NO_PARAMETER value!" << std::endl;
|
||||
}
|
||||
HasHkPoolParametersIF* hkOwner =
|
||||
objectManager->get<HasHkPoolParametersIF>(poolOwner);
|
||||
OwnsLocalDataPoolIF* hkOwner =
|
||||
objectManager->get<OwnsLocalDataPoolIF>(poolOwner);
|
||||
if(hkOwner == nullptr) {
|
||||
sif::error << "LocalPoolVariable: The supplied pool owner did not implement"
|
||||
"the correct interface HasHkPoolParametersIF!" << std::endl;
|
||||
|
55
datapoollocal/OwnsLocalDataPoolIF.h
Normal file
55
datapoollocal/OwnsLocalDataPoolIF.h
Normal file
@ -0,0 +1,55 @@
|
||||
#ifndef FRAMEWORK_DATAPOOL_HASHKPOOLPARAMETERSIF_H_
|
||||
#define FRAMEWORK_DATAPOOL_HASHKPOOLPARAMETERSIF_H_
|
||||
#include <framework/datapool/PoolEntryIF.h>
|
||||
#include <framework/ipc/MessageQueueSenderIF.h>
|
||||
#include <framework/housekeeping/HousekeepingMessage.h>
|
||||
#include <map>
|
||||
|
||||
class LocalDataPoolManager;
|
||||
class DataSetIF;
|
||||
/**
|
||||
* @brief Type definition for local pool entries.
|
||||
*/
|
||||
using lp_id_t = uint32_t;
|
||||
using LocalDataPool = std::map<lp_id_t, PoolEntryIF*>;
|
||||
using LocalDataPoolMapIter = LocalDataPool::iterator;
|
||||
|
||||
/**
|
||||
* @brief This interface is implemented by classes which posses a local
|
||||
* data pool (not the managing class). It defines the relationship
|
||||
* between the local data pool owner and the LocalDataPoolManager.
|
||||
* @details
|
||||
* Any class implementing this interface shall also have a LocalDataPoolManager
|
||||
* member class which contains the actual pool data structure
|
||||
* and exposes the public interface for it.
|
||||
* This is required because the pool entries are templates, which makes
|
||||
* specifying an interface rather difficult. The local data pool can be
|
||||
* accessed by using the LocalPoolVariable, LocalPoolVector or LocalDataSet
|
||||
* classes.
|
||||
*
|
||||
* Architectural Note:
|
||||
* This could be circumvented by using a wrapper/accessor function or
|
||||
* implementing the templated function in this interface..
|
||||
* The first solution sounds better than the second but
|
||||
* the LocalPoolVariable classes are templates as well, so this just shifts
|
||||
* the problem somewhere else. Interfaces are nice, but the most
|
||||
* pragmatic solution I found was to offer the client the full interface
|
||||
* of the LocalDataPoolManager.
|
||||
*/
|
||||
class OwnsLocalDataPoolIF {
|
||||
public:
|
||||
virtual~ OwnsLocalDataPoolIF() {};
|
||||
|
||||
static constexpr uint8_t INTERFACE_ID = CLASS_ID::HOUSEKEEPING;
|
||||
static constexpr ReturnValue_t POOL_ENTRY_NOT_FOUND = MAKE_RETURN_CODE(0XA0);
|
||||
static constexpr ReturnValue_t POOL_ENTRY_TYPE_CONFLICT = MAKE_RETURN_CODE(0xA1);
|
||||
|
||||
virtual MessageQueueId_t getCommandQueue() const = 0;
|
||||
virtual ReturnValue_t initializeHousekeepingPoolEntries(
|
||||
LocalDataPool& localDataPoolMap) = 0;
|
||||
//virtual float setMinimalHkSamplingFrequency() = 0;
|
||||
virtual LocalDataPoolManager* getHkManagerHandle() = 0;
|
||||
virtual DataSetIF* getDataSetHandle(sid_t sid) = 0;
|
||||
};
|
||||
|
||||
#endif /* FRAMEWORK_DATAPOOL_HASHKPOOLPARAMETERSIF_H_ */
|
Reference in New Issue
Block a user