cotinued distir datapool
This commit is contained in:
parent
e5ab7ada68
commit
a0b8f8855c
@ -41,6 +41,7 @@ public:
|
||||
virtual~ HasLocalDataPoolIF() {};
|
||||
|
||||
static constexpr uint8_t INTERFACE_ID = CLASS_ID::LOCAL_POOL_OWNER_IF;
|
||||
static constexpr lp_id_t NO_POOL_ID = 0xffffffff;
|
||||
|
||||
/** Command queue for housekeeping messages. */
|
||||
virtual MessageQueueId_t getCommandQueue() const = 0;
|
||||
|
@ -109,13 +109,32 @@ public:
|
||||
|
||||
/**
|
||||
* Different types of housekeeping reporting are possible.
|
||||
* 1. PERIODIC: HK packets are generated in fixed intervals
|
||||
* 2. UPDATED: HK packets are generated if a value was updated
|
||||
* 3. REQUESTED: HK packets are only generated if explicitely requested
|
||||
* 1. PERIODIC: HK packets are generated in fixed intervals and sent to
|
||||
* destination. Fromat will be raw.
|
||||
* 2. UPDATED: Notification will be sent out if HK data has changed.
|
||||
* Question: Send Raw data directly or just the message?
|
||||
* 3. REQUESTED: HK packets are only generated if explicitely requested.
|
||||
* Propably not necessary, just use multiple local data sets or
|
||||
* shared datasets.
|
||||
*
|
||||
* TODO: This is a big architecture question. Use raw data or shared
|
||||
* datasets? dumb thing about shared datasets: It propably would be better
|
||||
* if each task who uses the data has their own copy of the pool
|
||||
* variables. Then the LPIDs should be hardcoded in the dataset implementations
|
||||
* so the users don't have to worry about it anymore.
|
||||
*
|
||||
* Notifications should also be possible for single variables instead of
|
||||
* full dataset updates.
|
||||
*/
|
||||
enum class ReportingType: uint8_t {
|
||||
// Periodic generation of HK packets.
|
||||
PERIODIC,
|
||||
// Notification will be sent out as message.
|
||||
// Data is accessed via shared data set or multiple local data sets.
|
||||
ON_UPDATE,
|
||||
// actually, requested is propably unnecessary. If another component
|
||||
// needs data on request, they can just use the new SharedDataSet
|
||||
// which is thread-safe to also have full access to the interface..
|
||||
REQUESTED
|
||||
};
|
||||
|
||||
@ -136,6 +155,7 @@ private:
|
||||
*/
|
||||
struct HkReceiver {
|
||||
LocalDataSetBase* dataSet = nullptr;
|
||||
lp_id_t localPoolId = HasLocalDataPoolIF::NO_POOL_ID;
|
||||
MessageQueueId_t destinationQueue = MessageQueueIF::NO_QUEUE;
|
||||
ReportingType reportingType = ReportingType::PERIODIC;
|
||||
bool reportingStatus = true;
|
||||
|
@ -5,3 +5,7 @@ LocalDataSet::LocalDataSet(HasLocalDataPoolIF *hkOwner, const size_t maxSize):
|
||||
this->setContainer(poolVarList.data());
|
||||
}
|
||||
|
||||
LocalDataSet::LocalDataSet(object_id_t owner, const size_t maxSize):
|
||||
LocalDataSetBase(owner, nullptr, maxSize), poolVarList(maxSize) {
|
||||
this->setContainer(poolVarList.data());
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
class LocalDataSet: public LocalDataSetBase {
|
||||
public:
|
||||
LocalDataSet(HasLocalDataPoolIF* hkOwner, const size_t maxSize);
|
||||
|
||||
LocalDataSet(object_id_t owner, const size_t maxSize);
|
||||
virtual~ LocalDataSet() {};
|
||||
|
||||
//! Copying forbidden for now.
|
||||
|
@ -46,6 +46,8 @@ public:
|
||||
* owner should implement the HasHkPoolParametersIF.
|
||||
* The constructor simply sets the fill_count to zero and sets
|
||||
* the state to "uninitialized".
|
||||
* @details
|
||||
*
|
||||
*/
|
||||
LocalDataSetBase(object_id_t ownerId,
|
||||
PoolVariableIF** registeredVariablesArray,
|
||||
|
@ -28,7 +28,7 @@ inline LocalPoolVar<T>::LocalPoolVar(lp_id_t poolId,
|
||||
template<typename T>
|
||||
inline LocalPoolVar<T>::LocalPoolVar(lp_id_t poolId, object_id_t poolOwner,
|
||||
pool_rwm_t setReadWriteMode, DataSetIF *dataSet):
|
||||
readWriteMode(readWriteMode) {
|
||||
readWriteMode(setReadWriteMode) {
|
||||
if(poolId == PoolVariableIF::NO_PARAMETER) {
|
||||
sif::warning << "LocalPoolVector: 0 passed as pool ID, which is the "
|
||||
"NO_PARAMETER value!" << std::endl;
|
||||
|
@ -5,6 +5,13 @@
|
||||
#include <framework/objectmanager/SystemObject.h>
|
||||
#include <vector>
|
||||
|
||||
/**
|
||||
* Baseline question: If this dataset is shared, is there once instance
|
||||
* shared among many objects or multiple instances? Maybe be flexible
|
||||
* and provide both ways? Sharing one instance requires a mutex lock.
|
||||
* If there are multiple instances, it is not shared anymore, to be fair..
|
||||
* Then a regular local data set is sufficient.
|
||||
*/
|
||||
class SharedLocalDataSet: public SystemObject,
|
||||
public LocalDataSetBase,
|
||||
public SharedDataSetIF {
|
||||
@ -15,7 +22,6 @@ public:
|
||||
ReturnValue_t unlockDataset() override;
|
||||
private:
|
||||
|
||||
|
||||
MutexIF* datasetLock = nullptr;
|
||||
std::vector<PoolVariableIF*> poolVarVector;
|
||||
};
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef FRAMEWORK_DATAPOOLLOCAL_STATICLOCALDATASET_H_
|
||||
#define FRAMEWORK_DATAPOOLLOCAL_STATICLOCALDATASET_H_
|
||||
#include <framework/datapool/PoolDataSetBase.h>
|
||||
#include <framework/objectmanager/SystemObjectIF.h>
|
||||
#include <array>
|
||||
|
||||
/**
|
||||
@ -12,12 +13,16 @@
|
||||
* other software objects.
|
||||
* @tparam capacity
|
||||
*/
|
||||
template <uint8_t capacity>
|
||||
class StaticLocalDataSet: public PoolDataSetBase {
|
||||
StaticLocalDataSet(): PoolDataSetBase(poolVarList.data(), capacity) {}
|
||||
template <uint8_t NUM_VARIABLES>
|
||||
class StaticLocalDataSet: public LocalDataSetBase {
|
||||
public:
|
||||
StaticLocalDataSet(object_id_t owner):
|
||||
LocalDataSetBase(owner, poolVarList.data(), NUM_VARIABLES) {
|
||||
}
|
||||
|
||||
virtual~ StaticLocalDataSet();
|
||||
private:
|
||||
std::array<PoolVariableIF*, capacity> poolVarList;
|
||||
std::array<PoolVariableIF*, NUM_VARIABLES> poolVarList;
|
||||
};
|
||||
|
||||
#endif /* FRAMEWORK_DATAPOOLLOCAL_STATICLOCALDATASET_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user