Files
fsfw/datapoollocal/SharedLocalDataSet.h
T

38 lines
1.3 KiB
C++
Raw Normal View History

2020-10-01 12:05:24 +02:00
#ifndef FSFW_DATAPOOLLOCAL_SHAREDLOCALDATASET_H_
#define FSFW_DATAPOOLLOCAL_SHAREDLOCALDATASET_H_
#include "LocalPoolDataSetBase.h"
#include "../datapool/SharedDataSetIF.h"
#include "../objectmanager/SystemObject.h"
#include <vector>
2021-01-13 11:53:34 +01:00
/**
* This local dataset variation can be used if the dataset is used concurrently across
* multiple threads. It provides a lock in addition to all other functionalities provided
* by the LocalPoolDataSetBase class.
*
2021-03-10 23:16:47 +01:00
* The user is completely responsible for lockingand unlocking the dataset when using the
* shared dataset.
2021-01-13 11:53:34 +01:00
*/
2021-01-13 12:41:24 +01:00
class SharedLocalDataSet:
public SystemObject,
2020-10-01 12:05:24 +02:00
public LocalPoolDataSetBase,
public SharedDataSetIF {
public:
2021-03-10 23:16:47 +01:00
SharedLocalDataSet(object_id_t objectId, HasLocalDataPoolIF* owner, uint32_t setId,
2020-10-01 12:05:24 +02:00
const size_t maxSize);
2021-03-10 23:16:47 +01:00
SharedLocalDataSet(object_id_t objectId, sid_t sid, const size_t maxSize);
virtual~ SharedLocalDataSet();
2021-03-11 00:18:17 +01:00
ReturnValue_t lockDataset(MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING,
dur_millis_t mutexTimeout = 20) override;
2020-10-01 12:05:24 +02:00
ReturnValue_t unlockDataset() override;
private:
MutexIF* datasetLock = nullptr;
std::vector<PoolVariableIF*> poolVarVector;
};
#endif /* FSFW_DATAPOOLLOCAL_SHAREDLOCALDATASET_H_ */