issues with virtual inheritanc3
This commit is contained in:
parent
620b2ae79e
commit
78b6a83285
@ -8,8 +8,7 @@
|
|||||||
PoolDataSetBase::PoolDataSetBase(PoolVariableIF** registeredVariablesArray,
|
PoolDataSetBase::PoolDataSetBase(PoolVariableIF** registeredVariablesArray,
|
||||||
const size_t maxFillCount):
|
const size_t maxFillCount):
|
||||||
registeredVariables(registeredVariablesArray),
|
registeredVariables(registeredVariablesArray),
|
||||||
maxFillCount(maxFillCount) {
|
maxFillCount(maxFillCount) {}
|
||||||
}
|
|
||||||
|
|
||||||
PoolDataSetBase::~PoolDataSetBase() {}
|
PoolDataSetBase::~PoolDataSetBase() {}
|
||||||
|
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
#ifndef FRAMEWORK_DATAPOOL_SHAREDDATASETIF_H_
|
#ifndef FRAMEWORK_DATAPOOL_SHAREDDATASETIF_H_
|
||||||
#define FRAMEWORK_DATAPOOL_SHAREDDATASETIF_H_
|
#define FRAMEWORK_DATAPOOL_SHAREDDATASETIF_H_
|
||||||
|
|
||||||
#include "PoolDataSetIF.h"
|
#include "PoolDataSetIF.h"
|
||||||
|
|
||||||
class SharedDataSetIF: public PoolDataSetIF {
|
class SharedDataSetIF:
|
||||||
|
public PoolDataSetIF {
|
||||||
public:
|
public:
|
||||||
virtual ~SharedDataSetIF() {};
|
virtual ~SharedDataSetIF() {};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual ReturnValue_t lockDataset(dur_millis_t mutexTimeout) = 0;
|
virtual ReturnValue_t lockDataset(MutexIF::TimeoutType timeoutType,
|
||||||
|
dur_millis_t mutexTimeout) = 0;
|
||||||
virtual ReturnValue_t unlockDataset() = 0;
|
virtual ReturnValue_t unlockDataset() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -8,10 +8,6 @@ SharedLocalDataSet::SharedLocalDataSet(object_id_t objectId, sid_t sid,
|
|||||||
datasetLock = MutexFactory::instance()->createMutex();
|
datasetLock = MutexFactory::instance()->createMutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t SharedLocalDataSet::lockDataset(dur_millis_t mutexTimeout) {
|
|
||||||
return datasetLock->lockMutex(MutexIF::TimeoutType::WAITING, mutexTimeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
SharedLocalDataSet::SharedLocalDataSet(object_id_t objectId,
|
SharedLocalDataSet::SharedLocalDataSet(object_id_t objectId,
|
||||||
HasLocalDataPoolIF *owner, uint32_t setId,
|
HasLocalDataPoolIF *owner, uint32_t setId,
|
||||||
const size_t maxSize): SystemObject(objectId),
|
const size_t maxSize): SystemObject(objectId),
|
||||||
@ -20,10 +16,22 @@ SharedLocalDataSet::SharedLocalDataSet(object_id_t objectId,
|
|||||||
datasetLock = MutexFactory::instance()->createMutex();
|
datasetLock = MutexFactory::instance()->createMutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t SharedLocalDataSet::lockDataset(MutexIF::TimeoutType timeoutType,
|
||||||
|
dur_millis_t mutexTimeout) {
|
||||||
|
if(datasetLock != nullptr) {
|
||||||
|
return datasetLock->lockMutex(timeoutType, mutexTimeout);
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SharedLocalDataSet::~SharedLocalDataSet() {
|
SharedLocalDataSet::~SharedLocalDataSet() {
|
||||||
MutexFactory::instance()->deleteMutex(datasetLock);
|
MutexFactory::instance()->deleteMutex(datasetLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t SharedLocalDataSet::unlockDataset() {
|
ReturnValue_t SharedLocalDataSet::unlockDataset() {
|
||||||
|
if(datasetLock != nullptr) {
|
||||||
return datasetLock->unlockMutex();
|
return datasetLock->unlockMutex();
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,8 @@ public:
|
|||||||
|
|
||||||
virtual~ SharedLocalDataSet();
|
virtual~ SharedLocalDataSet();
|
||||||
|
|
||||||
ReturnValue_t lockDataset(dur_millis_t mutexTimeout) override;
|
ReturnValue_t lockDataset(MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING,
|
||||||
|
dur_millis_t mutexTimeout = 20) override;
|
||||||
ReturnValue_t unlockDataset() override;
|
ReturnValue_t unlockDataset() override;
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
#include <catch2/catch_approx.hpp>
|
#include <catch2/catch_approx.hpp>
|
||||||
|
|
||||||
#include <fsfw/datapoollocal/HasLocalDataPoolIF.h>
|
#include <fsfw/datapoollocal/HasLocalDataPoolIF.h>
|
||||||
|
#include <fsfw/datapoollocal/SharedLocalDataSet.h>
|
||||||
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
|
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
|
||||||
#include <fsfw/datapool/PoolReadGuard.h>
|
#include <fsfw/datapool/PoolReadGuard.h>
|
||||||
#include <fsfw/datapoollocal/SharedLocalDataSet.h>
|
|
||||||
#include <fsfw/globalfunctions/bitutility.h>
|
#include <fsfw/globalfunctions/bitutility.h>
|
||||||
|
|
||||||
#include <unittest/core/CatchDefinitions.h>
|
#include <unittest/core/CatchDefinitions.h>
|
||||||
@ -254,8 +254,12 @@ TEST_CASE("DataSetTest" , "[DataSetTest]") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SECTION("SharedDataSet") {
|
SECTION("SharedDataSet") {
|
||||||
object_id_t sharedSetId = objects::SHARED_SET_ID;
|
// object_id_t sharedSetId = objects::SHARED_SET_ID;
|
||||||
SharedLocalDataSet sharedSet(sharedSetId, poolOwner, 2, 5);
|
// SharedLocalDataSet sharedSet(sharedSetId, poolOwner, 2, 5);
|
||||||
|
// CHECK(sharedSet.initialize() == retval::CATCH_OK);
|
||||||
|
// CHECK(sharedSet.lockDataset() == retval::CATCH_OK);
|
||||||
|
//
|
||||||
|
// CHECK(sharedSet.unlockDataset() == retval::CATCH_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we need to reset the subscription list because the pool owner
|
/* we need to reset the subscription list because the pool owner
|
||||||
|
Loading…
Reference in New Issue
Block a user