fsfw/misc/archive/SharedLocalDataset.h

38 lines
1.1 KiB
C
Raw Permalink Normal View History

#pragma once
#include <vector>
#include "fsfw/datapool/SharedDataSetIF.h"
#include "fsfw/objectmanager/SystemObject.h"
#include "SharedSetBase.h"
#include "SharedPool.h"
namespace datapool {
/**
* 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.
*
* The user is completely responsible for locking and unlocking the dataset when using the
* shared dataset.
*/
class SharedLocalDataset : public SystemObject, public SharedSetBase, public SharedDataSetIF {
public:
SharedLocalDataset(object_id_t objectId, SharedPool& sharedPool, uint32_t setId,
size_t maxSize);
SharedLocalDataset(object_id_t objectId, sid_t sid, size_t maxSize);
~SharedLocalDataset() override;
ReturnValue_t lockDataset(MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING,
dur_millis_t mutexTimeout = 20) override;
ReturnValue_t unlockDataset() override;
private:
MutexIF* datasetLock = nullptr;
std::vector<PoolVariableIF*> poolVarVector;
};
}