2020-05-17 01:17:11 +02:00
|
|
|
#ifndef FRAMEWORK_DATAPOOL_HASHKPOOLPARAMETERSIF_H_
|
|
|
|
#define FRAMEWORK_DATAPOOL_HASHKPOOLPARAMETERSIF_H_
|
|
|
|
#include <framework/datapool/PoolEntryIF.h>
|
|
|
|
#include <framework/ipc/MessageQueueSenderIF.h>
|
2020-06-05 20:35:08 +02:00
|
|
|
#include <framework/housekeeping/HousekeepingMessage.h>
|
2020-05-17 01:17:11 +02:00
|
|
|
#include <map>
|
|
|
|
|
2020-06-07 02:22:18 +02:00
|
|
|
class LocalDataPoolManager;
|
2020-06-05 20:35:08 +02:00
|
|
|
class DataSetIF;
|
2020-05-17 01:17:11 +02:00
|
|
|
/**
|
|
|
|
* @brief Type definition for local pool entries.
|
|
|
|
*/
|
|
|
|
using lp_id_t = uint32_t;
|
2020-06-07 02:22:18 +02:00
|
|
|
using LocalDataPool = std::map<lp_id_t, PoolEntryIF*>;
|
|
|
|
using LocalDataPoolMapIter = LocalDataPool::iterator;
|
2020-05-17 01:17:11 +02:00
|
|
|
|
|
|
|
/**
|
2020-06-05 20:35:08 +02:00
|
|
|
* @brief This interface is implemented by classes which posses a local
|
2020-06-07 02:22:18 +02:00
|
|
|
* data pool (not the managing class). It defines the relationship
|
|
|
|
* between the local data pool owner and the LocalDataPoolManager.
|
2020-06-05 20:35:08 +02:00
|
|
|
* @details
|
2020-06-07 02:22:18 +02:00
|
|
|
* 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.
|
2020-06-05 20:35:08 +02:00
|
|
|
* This is required because the pool entries are templates, which makes
|
2020-06-07 02:22:18 +02:00
|
|
|
* specifying an interface rather difficult. The local data pool can be
|
|
|
|
* accessed by using the LocalPoolVariable, LocalPoolVector or LocalDataSet
|
|
|
|
* classes.
|
2020-06-05 20:35:08 +02:00
|
|
|
*
|
2020-06-07 02:22:18 +02:00
|
|
|
* 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
|
2020-06-05 20:35:08 +02:00
|
|
|
* 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
|
2020-06-07 02:22:18 +02:00
|
|
|
* of the LocalDataPoolManager.
|
2020-05-17 01:17:11 +02:00
|
|
|
*/
|
2020-07-09 00:59:10 +02:00
|
|
|
class HasLocalDataPoolIF {
|
2020-05-17 01:17:11 +02:00
|
|
|
public:
|
2020-07-09 00:59:10 +02:00
|
|
|
virtual~ HasLocalDataPoolIF() {};
|
2020-05-17 01:17:11 +02:00
|
|
|
|
2020-06-19 03:03:17 +02:00
|
|
|
static constexpr uint8_t INTERFACE_ID = CLASS_ID::LOCAL_POOL_OWNER_IF;
|
2020-07-16 11:45:23 +02:00
|
|
|
static constexpr lp_id_t NO_POOL_ID = 0xffffffff;
|
2020-06-05 20:35:08 +02:00
|
|
|
|
2020-08-08 19:43:28 +02:00
|
|
|
virtual object_id_t getObjectId() const = 0;
|
|
|
|
|
2020-06-19 14:25:03 +02:00
|
|
|
/** Command queue for housekeeping messages. */
|
2020-05-17 01:17:11 +02:00
|
|
|
virtual MessageQueueId_t getCommandQueue() const = 0;
|
2020-06-19 14:25:03 +02:00
|
|
|
|
|
|
|
/** Is used by pool owner to initialize the pool map once */
|
|
|
|
virtual ReturnValue_t initializePoolEntries(
|
|
|
|
LocalDataPool& localDataPoolMap) = 0;
|
|
|
|
|
|
|
|
/** Can be used to get a handle to the local data pool manager. */
|
2020-06-07 02:22:18 +02:00
|
|
|
virtual LocalDataPoolManager* getHkManagerHandle() = 0;
|
2020-06-19 14:25:03 +02:00
|
|
|
|
2020-08-08 19:43:28 +02:00
|
|
|
/**
|
|
|
|
* Returns the minimum sampling frequency, which will usually be the
|
|
|
|
* period the pool owner performs its periodic operation-
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
virtual dur_millis_t getPeriodicOperationFrequency() const = 0;
|
|
|
|
|
2020-06-19 14:25:03 +02:00
|
|
|
/**
|
|
|
|
* This function is used by the pool manager to get a valid dataset
|
|
|
|
* from a SID
|
|
|
|
* @param sid Corresponding structure ID
|
|
|
|
* @return
|
|
|
|
*/
|
2020-06-05 20:35:08 +02:00
|
|
|
virtual DataSetIF* getDataSetHandle(sid_t sid) = 0;
|
2020-06-19 14:25:03 +02:00
|
|
|
|
|
|
|
/* These function can be implemented by pool owner, as they are required
|
|
|
|
* by the housekeeping message interface */
|
|
|
|
virtual ReturnValue_t addDataSet(sid_t sid) {
|
|
|
|
return HasReturnvaluesIF::RETURN_FAILED;
|
|
|
|
};
|
|
|
|
virtual ReturnValue_t removeDataSet(sid_t sid) {
|
|
|
|
return HasReturnvaluesIF::RETURN_FAILED;
|
|
|
|
};
|
|
|
|
virtual ReturnValue_t changeCollectionInterval(sid_t sid,
|
|
|
|
dur_seconds_t newInterval) {
|
|
|
|
return HasReturnvaluesIF::RETURN_FAILED;
|
|
|
|
};
|
2020-05-17 01:17:11 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* FRAMEWORK_DATAPOOL_HASHKPOOLPARAMETERSIF_H_ */
|