WIP: somethings wrong.. #19
@ -20,7 +20,7 @@
|
|||||||
class PoolVariableIF : public SerializeIF {
|
class PoolVariableIF : public SerializeIF {
|
||||||
friend class PoolDataSetBase;
|
friend class PoolDataSetBase;
|
||||||
friend class GlobDataSet;
|
friend class GlobDataSet;
|
||||||
friend class LocalDataSetBase;
|
friend class LocalPoolDataSetBase;
|
||||||
public:
|
public:
|
||||||
static constexpr uint8_t INTERFACE_ID = CLASS_ID::POOL_VARIABLE_IF;
|
static constexpr uint8_t INTERFACE_ID = CLASS_ID::POOL_VARIABLE_IF;
|
||||||
static constexpr ReturnValue_t INVALID_READ_WRITE_MODE = MAKE_RETURN_CODE(0xA0);
|
static constexpr ReturnValue_t INVALID_READ_WRITE_MODE = MAKE_RETURN_CODE(0xA0);
|
||||||
|
@ -116,7 +116,7 @@ const HasLocalDataPoolIF* LocalDataPoolManager::getOwner() const {
|
|||||||
|
|
||||||
ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid,
|
ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid,
|
||||||
MessageQueueId_t sendTo) {
|
MessageQueueId_t sendTo) {
|
||||||
LocalDataSetBase* dataSetToSerialize = dynamic_cast<LocalDataSetBase*>(
|
LocalPoolDataSetBase* dataSetToSerialize = dynamic_cast<LocalPoolDataSetBase*>(
|
||||||
owner->getDataSetHandle(sid));
|
owner->getDataSetHandle(sid));
|
||||||
if(dataSetToSerialize == nullptr) {
|
if(dataSetToSerialize == nullptr) {
|
||||||
sif::warning << "HousekeepingManager::generateHousekeepingPacket:"
|
sif::warning << "HousekeepingManager::generateHousekeepingPacket:"
|
||||||
@ -155,7 +155,7 @@ ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid) {
|
ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid) {
|
||||||
LocalDataSetBase* dataSet = dynamic_cast<LocalDataSetBase*>(
|
LocalPoolDataSetBase* dataSet = dynamic_cast<LocalPoolDataSetBase*>(
|
||||||
owner->getDataSetHandle(sid));
|
owner->getDataSetHandle(sid));
|
||||||
if(dataSet == nullptr) {
|
if(dataSet == nullptr) {
|
||||||
sif::warning << "HousekeepingManager::generateHousekeepingPacket:"
|
sif::warning << "HousekeepingManager::generateHousekeepingPacket:"
|
||||||
@ -186,7 +186,7 @@ void LocalDataPoolManager::setMinimalSamplingFrequency(float frequencySeconds) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t LocalDataPoolManager::serializeHkPacketIntoStore(
|
ReturnValue_t LocalDataPoolManager::serializeHkPacketIntoStore(
|
||||||
store_address_t *storeId, LocalDataSetBase* dataSet) {
|
store_address_t *storeId, LocalPoolDataSetBase* dataSet) {
|
||||||
size_t hkSize = dataSet->getSerializedSize();
|
size_t hkSize = dataSet->getSerializedSize();
|
||||||
uint8_t* storePtr = nullptr;
|
uint8_t* storePtr = nullptr;
|
||||||
ReturnValue_t result = ipcStore->getFreeElement(storeId, hkSize,&storePtr);
|
ReturnValue_t result = ipcStore->getFreeElement(storeId, hkSize,&storePtr);
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
class LocalDataSetBase;
|
class LocalPoolDataSetBase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This class is the managing instance for local data pool.
|
* @brief This class is the managing instance for local data pool.
|
||||||
@ -38,7 +38,7 @@ class LocalDataPoolManager {
|
|||||||
friend class LocalPoolVar;
|
friend class LocalPoolVar;
|
||||||
template<typename T, uint16_t vecSize>
|
template<typename T, uint16_t vecSize>
|
||||||
friend class LocalPoolVector;
|
friend class LocalPoolVector;
|
||||||
friend class LocalDataSetBase;
|
friend class LocalPoolDataSetBase;
|
||||||
public:
|
public:
|
||||||
static constexpr uint8_t INTERFACE_ID = CLASS_ID::HOUSEKEEPING_MANAGER;
|
static constexpr uint8_t INTERFACE_ID = CLASS_ID::HOUSEKEEPING_MANAGER;
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ private:
|
|||||||
* The data pool manager will keep an internal map of HK receivers.
|
* The data pool manager will keep an internal map of HK receivers.
|
||||||
*/
|
*/
|
||||||
struct HkReceiver {
|
struct HkReceiver {
|
||||||
LocalDataSetBase* dataSet = nullptr;
|
LocalPoolDataSetBase* dataSet = nullptr;
|
||||||
lp_id_t localPoolId = HasLocalDataPoolIF::NO_POOL_ID;
|
lp_id_t localPoolId = HasLocalDataPoolIF::NO_POOL_ID;
|
||||||
MessageQueueId_t destinationQueue = MessageQueueIF::NO_QUEUE;
|
MessageQueueId_t destinationQueue = MessageQueueIF::NO_QUEUE;
|
||||||
ReportingType reportingType = ReportingType::PERIODIC;
|
ReportingType reportingType = ReportingType::PERIODIC;
|
||||||
@ -222,7 +222,7 @@ private:
|
|||||||
|
|
||||||
void setMinimalSamplingFrequency(float frequencySeconds);
|
void setMinimalSamplingFrequency(float frequencySeconds);
|
||||||
ReturnValue_t serializeHkPacketIntoStore(store_address_t* storeId,
|
ReturnValue_t serializeHkPacketIntoStore(store_address_t* storeId,
|
||||||
LocalDataSetBase* dataSet);
|
LocalPoolDataSetBase* dataSet);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
LocalDataSet::LocalDataSet(HasLocalDataPoolIF *hkOwner,
|
LocalDataSet::LocalDataSet(HasLocalDataPoolIF *hkOwner,
|
||||||
const size_t maxNumberOfVariables):
|
const size_t maxNumberOfVariables):
|
||||||
LocalDataSetBase(hkOwner,poolVarList.data(), maxNumberOfVariables) {
|
LocalPoolDataSetBase(hkOwner,poolVarList.data(), maxNumberOfVariables) {
|
||||||
poolVarList.reserve(maxNumberOfVariables);
|
poolVarList.reserve(maxNumberOfVariables);
|
||||||
poolVarList.resize(maxNumberOfVariables);
|
poolVarList.resize(maxNumberOfVariables);
|
||||||
if(hkOwner == nullptr) {
|
if(hkOwner == nullptr) {
|
||||||
@ -20,7 +20,7 @@ LocalDataSet::LocalDataSet(HasLocalDataPoolIF *hkOwner,
|
|||||||
|
|
||||||
LocalDataSet::LocalDataSet(object_id_t ownerId,
|
LocalDataSet::LocalDataSet(object_id_t ownerId,
|
||||||
const size_t maxNumberOfVariables):
|
const size_t maxNumberOfVariables):
|
||||||
LocalDataSetBase(ownerId, poolVarList.data(), maxNumberOfVariables) {
|
LocalPoolDataSetBase(ownerId, poolVarList.data(), maxNumberOfVariables) {
|
||||||
poolVarList.reserve(maxNumberOfVariables);
|
poolVarList.reserve(maxNumberOfVariables);
|
||||||
poolVarList.resize(maxNumberOfVariables);
|
poolVarList.resize(maxNumberOfVariables);
|
||||||
HasLocalDataPoolIF* hkOwner = objectManager->get<HasLocalDataPoolIF>(
|
HasLocalDataPoolIF* hkOwner = objectManager->get<HasLocalDataPoolIF>(
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include <framework/datapoollocal/LocalPoolDataSetBase.h>
|
#include <framework/datapoollocal/LocalPoolDataSetBase.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class LocalDataSet: public LocalDataSetBase {
|
class LocalDataSet: public LocalPoolDataSetBase {
|
||||||
public:
|
public:
|
||||||
LocalDataSet(HasLocalDataPoolIF* hkOwner, const size_t maxSize);
|
LocalDataSet(HasLocalDataPoolIF* hkOwner, const size_t maxSize);
|
||||||
LocalDataSet(object_id_t owner, const size_t maxSize);
|
LocalDataSet(object_id_t owner, const size_t maxSize);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
LocalDataSetBase::LocalDataSetBase(HasLocalDataPoolIF *hkOwner,
|
LocalPoolDataSetBase::LocalPoolDataSetBase(HasLocalDataPoolIF *hkOwner,
|
||||||
PoolVariableIF** registeredVariablesArray,
|
PoolVariableIF** registeredVariablesArray,
|
||||||
const size_t maxNumberOfVariables):
|
const size_t maxNumberOfVariables):
|
||||||
PoolDataSetBase(registeredVariablesArray, maxNumberOfVariables) {
|
PoolDataSetBase(registeredVariablesArray, maxNumberOfVariables) {
|
||||||
@ -17,7 +17,7 @@ LocalDataSetBase::LocalDataSetBase(HasLocalDataPoolIF *hkOwner,
|
|||||||
hkManager = hkOwner->getHkManagerHandle();
|
hkManager = hkOwner->getHkManagerHandle();
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalDataSetBase::LocalDataSetBase(object_id_t ownerId,
|
LocalPoolDataSetBase::LocalPoolDataSetBase(object_id_t ownerId,
|
||||||
PoolVariableIF** registeredVariablesArray,
|
PoolVariableIF** registeredVariablesArray,
|
||||||
const size_t maxNumberOfVariables):
|
const size_t maxNumberOfVariables):
|
||||||
PoolDataSetBase(registeredVariablesArray, maxNumberOfVariables) {
|
PoolDataSetBase(registeredVariablesArray, maxNumberOfVariables) {
|
||||||
@ -31,15 +31,15 @@ LocalDataSetBase::LocalDataSetBase(object_id_t ownerId,
|
|||||||
hkManager = hkOwner->getHkManagerHandle();
|
hkManager = hkOwner->getHkManagerHandle();
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalDataSetBase::~LocalDataSetBase() {
|
LocalPoolDataSetBase::~LocalPoolDataSetBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t LocalDataSetBase::lockDataPool(uint32_t timeoutMs) {
|
ReturnValue_t LocalPoolDataSetBase::lockDataPool(uint32_t timeoutMs) {
|
||||||
MutexIF* mutex = hkManager->getMutexHandle();
|
MutexIF* mutex = hkManager->getMutexHandle();
|
||||||
return mutex->lockMutex(MutexIF::TimeoutType::WAITING, timeoutMs);
|
return mutex->lockMutex(MutexIF::TimeoutType::WAITING, timeoutMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t LocalDataSetBase::serializeWithValidityBuffer(uint8_t **buffer,
|
ReturnValue_t LocalPoolDataSetBase::serializeWithValidityBuffer(uint8_t **buffer,
|
||||||
size_t *size, size_t maxSize,
|
size_t *size, size_t maxSize,
|
||||||
SerializeIF::Endianness streamEndianness) const {
|
SerializeIF::Endianness streamEndianness) const {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
|
||||||
@ -72,12 +72,12 @@ ReturnValue_t LocalDataSetBase::serializeWithValidityBuffer(uint8_t **buffer,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t LocalDataSetBase::unlockDataPool() {
|
ReturnValue_t LocalPoolDataSetBase::unlockDataPool() {
|
||||||
MutexIF* mutex = hkManager->getMutexHandle();
|
MutexIF* mutex = hkManager->getMutexHandle();
|
||||||
return mutex->unlockMutex();
|
return mutex->unlockMutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t LocalDataSetBase::serializeLocalPoolIds(uint8_t** buffer,
|
ReturnValue_t LocalPoolDataSetBase::serializeLocalPoolIds(uint8_t** buffer,
|
||||||
size_t* size, size_t maxSize,
|
size_t* size, size_t maxSize,
|
||||||
SerializeIF::Endianness streamEndianness) const {
|
SerializeIF::Endianness streamEndianness) const {
|
||||||
for (uint16_t count = 0; count < fillCount; count++) {
|
for (uint16_t count = 0; count < fillCount; count++) {
|
||||||
@ -93,7 +93,7 @@ ReturnValue_t LocalDataSetBase::serializeLocalPoolIds(uint8_t** buffer,
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalDataSetBase::bitSetter(uint8_t* byte, uint8_t position) const {
|
void LocalPoolDataSetBase::bitSetter(uint8_t* byte, uint8_t position) const {
|
||||||
if(position > 7) {
|
if(position > 7) {
|
||||||
sif::debug << "Pool Raw Access: Bit setting invalid position" << std::endl;
|
sif::debug << "Pool Raw Access: Bit setting invalid position" << std::endl;
|
||||||
return;
|
return;
|
||||||
@ -102,6 +102,6 @@ void LocalDataSetBase::bitSetter(uint8_t* byte, uint8_t position) const {
|
|||||||
*byte |= 1 << shiftNumber;
|
*byte |= 1 << shiftNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LocalDataSetBase::isValid() const {
|
bool LocalPoolDataSetBase::isValid() const {
|
||||||
return this->valid;
|
return this->valid;
|
||||||
}
|
}
|
||||||
|
@ -30,14 +30,14 @@ class LocalDataPoolManager;
|
|||||||
*
|
*
|
||||||
* @ingroup data_pool
|
* @ingroup data_pool
|
||||||
*/
|
*/
|
||||||
class LocalDataSetBase: public PoolDataSetBase {
|
class LocalPoolDataSetBase: public PoolDataSetBase {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Constructor for the creator of local pool data.
|
* @brief Constructor for the creator of local pool data.
|
||||||
* The constructor simply sets the fill_count to zero and sets
|
* The constructor simply sets the fill_count to zero and sets
|
||||||
* the state to "uninitialized".
|
* the state to "uninitialized".
|
||||||
*/
|
*/
|
||||||
LocalDataSetBase(HasLocalDataPoolIF *hkOwner,
|
LocalPoolDataSetBase(HasLocalDataPoolIF *hkOwner,
|
||||||
PoolVariableIF** registeredVariablesArray,
|
PoolVariableIF** registeredVariablesArray,
|
||||||
const size_t maxNumberOfVariables);
|
const size_t maxNumberOfVariables);
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ public:
|
|||||||
* @details
|
* @details
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
LocalDataSetBase(object_id_t ownerId,
|
LocalPoolDataSetBase(object_id_t ownerId,
|
||||||
PoolVariableIF** registeredVariablesArray,
|
PoolVariableIF** registeredVariablesArray,
|
||||||
const size_t maxNumberOfVariables);
|
const size_t maxNumberOfVariables);
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ public:
|
|||||||
* the destructor parses all variables that are still registered to the set.
|
* the destructor parses all variables that are still registered to the set.
|
||||||
* For each, the valid flag in the data pool is set to "invalid".
|
* For each, the valid flag in the data pool is set to "invalid".
|
||||||
*/
|
*/
|
||||||
~LocalDataSetBase();
|
~LocalPoolDataSetBase();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Special version of the serilization function which appends a
|
* Special version of the serilization function which appends a
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
SharedLocalDataSet::SharedLocalDataSet(object_id_t objectId, object_id_t owner,
|
SharedLocalDataSet::SharedLocalDataSet(object_id_t objectId, object_id_t owner,
|
||||||
const size_t maxSize): SystemObject(objectId),
|
const size_t maxSize): SystemObject(objectId),
|
||||||
LocalDataSetBase(owner, nullptr, maxSize) {
|
LocalPoolDataSetBase(owner, nullptr, maxSize) {
|
||||||
this->setContainer(poolVarVector.data());
|
this->setContainer(poolVarVector.data());
|
||||||
datasetLock = MutexFactory::instance()->createMutex();
|
datasetLock = MutexFactory::instance()->createMutex();
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* Then a regular local data set is sufficient.
|
* Then a regular local data set is sufficient.
|
||||||
*/
|
*/
|
||||||
class SharedLocalDataSet: public SystemObject,
|
class SharedLocalDataSet: public SystemObject,
|
||||||
public LocalDataSetBase,
|
public LocalPoolDataSetBase,
|
||||||
public SharedDataSetIF {
|
public SharedDataSetIF {
|
||||||
public:
|
public:
|
||||||
SharedLocalDataSet(object_id_t objectId, object_id_t owner,
|
SharedLocalDataSet(object_id_t objectId, object_id_t owner,
|
||||||
|
@ -14,13 +14,12 @@
|
|||||||
* @tparam capacity
|
* @tparam capacity
|
||||||
*/
|
*/
|
||||||
template <uint8_t NUM_VARIABLES>
|
template <uint8_t NUM_VARIABLES>
|
||||||
class StaticLocalDataSet: public LocalDataSetBase {
|
class StaticLocalDataSet: public LocalPoolDataSetBase {
|
||||||
public:
|
public:
|
||||||
StaticLocalDataSet(object_id_t owner):
|
StaticLocalDataSet(object_id_t owner):
|
||||||
LocalDataSetBase(owner, poolVarList.data(), NUM_VARIABLES) {
|
LocalPoolDataSetBase(owner, poolVarList.data(), NUM_VARIABLES) {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual~ StaticLocalDataSet() {};
|
|
||||||
private:
|
private:
|
||||||
std::array<PoolVariableIF*, NUM_VARIABLES> poolVarList;
|
std::array<PoolVariableIF*, NUM_VARIABLES> poolVarList;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user