Merge remote-tracking branch 'upstream/development' into develop_update
This commit is contained in:
@ -28,9 +28,11 @@ class FixedArrayList : public ArrayList<T, count_t> {
|
||||
}
|
||||
|
||||
FixedArrayList& operator=(FixedArrayList other) {
|
||||
memcpy(this->data, other.data, sizeof(this->data));
|
||||
this->entries = data;
|
||||
this->size = other.size;
|
||||
for (size_t idx = 0; idx < this->size; idx++) {
|
||||
data[idx] = other.data[idx];
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "fsfw/globalfunctions/timevalOperations.h"
|
||||
|
||||
timeval& operator+=(timeval& lhs, const timeval& rhs) {
|
||||
int64_t sum = lhs.tv_sec * 1000000. + lhs.tv_usec;
|
||||
sum += rhs.tv_sec * 1000000. + rhs.tv_usec;
|
||||
int64_t sum = static_cast<int64_t>(lhs.tv_sec) * 1000000. + lhs.tv_usec;
|
||||
sum += static_cast<int64_t>(rhs.tv_sec) * 1000000. + rhs.tv_usec;
|
||||
lhs.tv_sec = sum / 1000000;
|
||||
lhs.tv_usec = sum - lhs.tv_sec * 1000000;
|
||||
return lhs;
|
||||
|
@ -31,9 +31,8 @@ LocalPool::LocalPool(object_id_t setObjectId, const LocalPoolConfig& poolConfig,
|
||||
|
||||
LocalPool::~LocalPool() = default;
|
||||
|
||||
ReturnValue_t LocalPool::addData(store_address_t* storageId, const uint8_t* data, size_t size,
|
||||
bool ignoreFault) {
|
||||
ReturnValue_t status = reserveSpace(size, storageId, ignoreFault);
|
||||
ReturnValue_t LocalPool::addData(store_address_t* storageId, const uint8_t* data, size_t size) {
|
||||
ReturnValue_t status = reserveSpace(size, storageId);
|
||||
if (status == returnvalue::OK) {
|
||||
write(*storageId, data, size);
|
||||
}
|
||||
@ -49,8 +48,8 @@ ReturnValue_t LocalPool::getData(store_address_t packetId, const uint8_t** packe
|
||||
}
|
||||
|
||||
ReturnValue_t LocalPool::getFreeElement(store_address_t* storageId, const size_t size,
|
||||
uint8_t** pData, bool ignoreFault) {
|
||||
ReturnValue_t status = reserveSpace(size, storageId, ignoreFault);
|
||||
uint8_t** pData) {
|
||||
ReturnValue_t status = reserveSpace(size, storageId);
|
||||
if (status == returnvalue::OK) {
|
||||
*pData = &store[storageId->poolIndex][getRawPosition(*storageId)];
|
||||
} else {
|
||||
@ -167,7 +166,7 @@ void LocalPool::clearStore() {
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t LocalPool::reserveSpace(size_t size, store_address_t* storeId, bool ignoreFault) {
|
||||
ReturnValue_t LocalPool::reserveSpace(size_t size, store_address_t* storeId) {
|
||||
ReturnValue_t status = getSubPoolIndex(size, &storeId->poolIndex);
|
||||
if (status != returnvalue::OK) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
@ -318,27 +317,3 @@ bool LocalPool::hasDataAtId(store_address_t storeId) const {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
ReturnValue_t LocalPool::getFreeElement(store_address_t* storeId, size_t size, uint8_t** pData) {
|
||||
return StorageManagerIF::getFreeElement(storeId, size, pData);
|
||||
}
|
||||
|
||||
ConstAccessorPair LocalPool::getData(store_address_t storeId) {
|
||||
return StorageManagerIF::getData(storeId);
|
||||
}
|
||||
|
||||
ReturnValue_t LocalPool::addData(store_address_t* storeId, const uint8_t* data, size_t size) {
|
||||
return StorageManagerIF::addData(storeId, data, size);
|
||||
}
|
||||
|
||||
ReturnValue_t LocalPool::getData(store_address_t storeId, ConstStorageAccessor& accessor) {
|
||||
return StorageManagerIF::getData(storeId, accessor);
|
||||
}
|
||||
|
||||
ReturnValue_t LocalPool::modifyData(store_address_t storeId, StorageAccessor& accessor) {
|
||||
return StorageManagerIF::modifyData(storeId, accessor);
|
||||
}
|
||||
|
||||
AccessorPair LocalPool::modifyData(store_address_t storeId) {
|
||||
return StorageManagerIF::modifyData(storeId);
|
||||
}
|
||||
|
@ -86,21 +86,13 @@ class LocalPool : public SystemObject, public StorageManagerIF {
|
||||
/**
|
||||
* Documentation: See StorageManagerIF.h
|
||||
*/
|
||||
ReturnValue_t addData(store_address_t* storeId, const uint8_t* data, size_t size,
|
||||
bool ignoreFault) override;
|
||||
ReturnValue_t addData(store_address_t* storeId, const uint8_t* data, size_t size) override;
|
||||
|
||||
ReturnValue_t getFreeElement(store_address_t* storeId, size_t size, uint8_t** pData) override;
|
||||
ReturnValue_t getFreeElement(store_address_t* storeId, size_t size, uint8_t** pData,
|
||||
bool ignoreFault) override;
|
||||
|
||||
ConstAccessorPair getData(store_address_t storeId) override;
|
||||
ReturnValue_t getData(store_address_t storeId, ConstStorageAccessor& accessor) override;
|
||||
ReturnValue_t getData(store_address_t storeId, const uint8_t** packet_ptr, size_t* size) override;
|
||||
|
||||
AccessorPair modifyData(store_address_t storeId) override;
|
||||
ReturnValue_t modifyData(store_address_t storeId, uint8_t** packet_ptr, size_t* size) override;
|
||||
ReturnValue_t modifyData(store_address_t storeId, StorageAccessor& accessor) override;
|
||||
|
||||
ReturnValue_t deleteData(store_address_t storeId) override;
|
||||
ReturnValue_t deleteData(uint8_t* ptr, size_t size, store_address_t* storeId) override;
|
||||
@ -136,6 +128,12 @@ class LocalPool : public SystemObject, public StorageManagerIF {
|
||||
[[nodiscard]] max_subpools_t getNumberOfSubPools() const override;
|
||||
[[nodiscard]] bool hasDataAtId(store_address_t storeId) const override;
|
||||
|
||||
// Using functions provided by StorageManagerIF requires either a fully qualified path
|
||||
// like for example localPool.StorageManagerIF::getFreeElement(...) or re-exporting
|
||||
// the fully qualified path with the using directive.
|
||||
using StorageManagerIF::getData;
|
||||
using StorageManagerIF::modifyData;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* With this helper method, a free element of @c size is reserved.
|
||||
@ -144,7 +142,7 @@ class LocalPool : public SystemObject, public StorageManagerIF {
|
||||
* @return - returnvalue::OK on success,
|
||||
* - the return codes of #getPoolIndex or #findEmpty otherwise.
|
||||
*/
|
||||
virtual ReturnValue_t reserveSpace(size_t size, store_address_t* address, bool ignoreFault);
|
||||
virtual ReturnValue_t reserveSpace(size_t size, store_address_t* address);
|
||||
|
||||
private:
|
||||
/**
|
||||
@ -188,6 +186,8 @@ class LocalPool : public SystemObject, public StorageManagerIF {
|
||||
std::vector<std::vector<size_type>> sizeLists =
|
||||
std::vector<std::vector<size_type>>(NUMBER_OF_SUBPOOLS);
|
||||
|
||||
bool ignoreFault = false;
|
||||
|
||||
//! A variable to determine whether higher n pools are used if
|
||||
//! the store is full.
|
||||
bool spillsToHigherPools = false;
|
||||
|
@ -9,10 +9,9 @@ PoolManager::PoolManager(object_id_t setObjectId, const LocalPoolConfig& localPo
|
||||
|
||||
PoolManager::~PoolManager() { MutexFactory::instance()->deleteMutex(mutex); }
|
||||
|
||||
ReturnValue_t PoolManager::reserveSpace(const size_t size, store_address_t* address,
|
||||
bool ignoreFault) {
|
||||
ReturnValue_t PoolManager::reserveSpace(const size_t size, store_address_t* address) {
|
||||
MutexGuard mutexHelper(mutex, MutexIF::TimeoutType::WAITING, mutexTimeoutMs);
|
||||
ReturnValue_t status = LocalPool::reserveSpace(size, address, ignoreFault);
|
||||
ReturnValue_t status = LocalPool::reserveSpace(size, address);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ class PoolManager : public LocalPool {
|
||||
//! Default mutex timeout value to prevent permanent blocking.
|
||||
uint32_t mutexTimeoutMs = 20;
|
||||
|
||||
ReturnValue_t reserveSpace(size_t size, store_address_t* address, bool ignoreFault) override;
|
||||
ReturnValue_t reserveSpace(size_t size, store_address_t* address) override;
|
||||
|
||||
/**
|
||||
* @brief The mutex is created in the constructor and makes
|
||||
|
@ -55,7 +55,7 @@ class StorageManagerIF {
|
||||
/**
|
||||
* @brief This is the empty virtual destructor as required for C++ interfaces.
|
||||
*/
|
||||
~StorageManagerIF() = default;
|
||||
virtual ~StorageManagerIF() = default;
|
||||
/**
|
||||
* @brief With addData, a free storage position is allocated and data
|
||||
* stored there.
|
||||
@ -66,12 +66,7 @@ class StorageManagerIF {
|
||||
* @return Returns @returnvalue::OK if data was added.
|
||||
* @returnvalue::FAILED if data could not be added, storageId is unchanged then.
|
||||
*/
|
||||
virtual ReturnValue_t addData(store_address_t* storageId, const uint8_t* data, size_t size,
|
||||
bool ignoreFault) = 0;
|
||||
|
||||
virtual ReturnValue_t addData(store_address_t* storageId, const uint8_t* data, size_t size) {
|
||||
return addData(storageId, data, size, false);
|
||||
}
|
||||
virtual ReturnValue_t addData(store_address_t* storageId, const uint8_t* data, size_t size) = 0;
|
||||
|
||||
/**
|
||||
* @brief With deleteData, the storageManager frees the memory region
|
||||
@ -186,12 +181,7 @@ class StorageManagerIF {
|
||||
* @return Returns @returnvalue::OK if data was added.
|
||||
* @returnvalue::FAILED if data could not be added, storageId is unchanged then.
|
||||
*/
|
||||
virtual ReturnValue_t getFreeElement(store_address_t* storageId, size_t size, uint8_t** dataPtr,
|
||||
bool ignoreFault) = 0;
|
||||
|
||||
virtual ReturnValue_t getFreeElement(store_address_t* storageId, size_t size, uint8_t** dataPtr) {
|
||||
return getFreeElement(storageId, size, dataPtr, false);
|
||||
}
|
||||
virtual ReturnValue_t getFreeElement(store_address_t* storageId, size_t size, uint8_t** dataPtr) = 0;
|
||||
|
||||
[[nodiscard]] virtual bool hasDataAtId(store_address_t storeId) const = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user