merged changes
This commit is contained in:
parent
224248dfa1
commit
485e96f12f
@ -1,6 +1,7 @@
|
||||
#include "ConstStorageAccessor.h"
|
||||
#include "StorageManagerIF.h"
|
||||
|
||||
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||
#include "../storagemanager/ConstStorageAccessor.h"
|
||||
#include "../storagemanager/StorageManagerIF.h"
|
||||
#include "../globalfunctions/arrayprinter.h"
|
||||
|
||||
ConstStorageAccessor::ConstStorageAccessor(store_address_t storeId):
|
||||
@ -14,12 +15,7 @@ ConstStorageAccessor::ConstStorageAccessor(store_address_t storeId,
|
||||
|
||||
ConstStorageAccessor::~ConstStorageAccessor() {
|
||||
if(deleteData and store != nullptr) {
|
||||
ReturnValue_t result = store->deleteData(storeId);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
// Configuration error.
|
||||
sif::error << "ConstStorageAccessor::~ConstStorageAccessor: "
|
||||
<< "Could not delete entry!" << std::endl;
|
||||
}
|
||||
store->deleteData(storeId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,7 +58,8 @@ ReturnValue_t ConstStorageAccessor::getDataCopy(uint8_t *pointer,
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
if(size_ > maxSize) {
|
||||
sif::error << "StorageAccessor: Supplied buffer not large enough" << std::endl;
|
||||
sif::error << "StorageAccessor: Supplied buffer not large enough"
|
||||
<< std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
std::copy(constDataPointer, constDataPointer + size_, pointer);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef FRAMEWORK_STORAGEMANAGER_CONSTSTORAGEACCESSOR_H_
|
||||
#define FRAMEWORK_STORAGEMANAGER_CONSTSTORAGEACCESSOR_H_
|
||||
#ifndef FSFW_STORAGEMANAGER_CONSTSTORAGEACCESSOR_H_
|
||||
#define FSFW_STORAGEMANAGER_CONSTSTORAGEACCESSOR_H_
|
||||
|
||||
#include "../storagemanager/storeAddress.h"
|
||||
#include "storeAddress.h"
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
#include <cstddef>
|
||||
|
||||
@ -113,4 +113,4 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
#endif /* FRAMEWORK_STORAGEMANAGER_CONSTSTORAGEACCESSOR_H_ */
|
||||
#endif /* FSFW_STORAGEMANAGER_CONSTSTORAGEACCESSOR_H_ */
|
||||
|
@ -1,14 +1,15 @@
|
||||
#ifndef FRAMEWORK_STORAGEMANAGER_LOCALPOOL_H_
|
||||
#define FRAMEWORK_STORAGEMANAGER_LOCALPOOL_H_
|
||||
#ifndef FSFW_STORAGEMANAGER_LOCALPOOL_H_
|
||||
#define FSFW_STORAGEMANAGER_LOCALPOOL_H_
|
||||
|
||||
#include "StorageManagerIF.h"
|
||||
#include "../objectmanager/SystemObject.h"
|
||||
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||
#include "../storagemanager/StorageManagerIF.h"
|
||||
#include "../objectmanager/ObjectManagerIF.h"
|
||||
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||
#include "../internalError/InternalErrorReporterIF.h"
|
||||
#include "../storagemanager/StorageAccessor.h"
|
||||
#include <cstring>
|
||||
|
||||
|
||||
/**
|
||||
* @brief The LocalPool class provides an intermediate data storage with
|
||||
* a fixed pool size policy.
|
||||
@ -184,6 +185,6 @@ private:
|
||||
ReturnValue_t findEmpty(uint16_t pool_index, uint16_t* element);
|
||||
};
|
||||
|
||||
#include "../storagemanager/LocalPool.tpp"
|
||||
#include "LocalPool.tpp"
|
||||
|
||||
#endif /* FRAMEWORK_STORAGEMANAGER_LOCALPOOL_H_ */
|
||||
#endif /* FSFW_STORAGEMANAGER_LOCALPOOL_H_ */
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef FRAMEWORK_STORAGEMANAGER_LOCALPOOL_TPP_
|
||||
#define FRAMEWORK_STORAGEMANAGER_LOCALPOOL_TPP_
|
||||
#ifndef FSFW_STORAGEMANAGER_LOCALPOOL_TPP_
|
||||
#define FSFW_STORAGEMANAGER_LOCALPOOL_TPP_
|
||||
|
||||
#ifndef FRAMEWORK_STORAGEMANAGER_LOCALPOOL_H_
|
||||
#ifndef FSFW_STORAGEMANAGER_LOCALPOOL_H_
|
||||
#error Include LocalPool.h before LocalPool.tpp!
|
||||
#endif
|
||||
|
||||
@ -125,9 +125,10 @@ inline LocalPool<NUMBER_OF_POOLS>::~LocalPool(void) {
|
||||
}
|
||||
}
|
||||
|
||||
template<uint8_t NUMBER_OF_POOLS> inline
|
||||
ReturnValue_t LocalPool<NUMBER_OF_POOLS>::addData(store_address_t* storageId,
|
||||
const uint8_t* data, size_t size, bool ignoreFault) {
|
||||
template<uint8_t NUMBER_OF_POOLS>
|
||||
inline ReturnValue_t LocalPool<NUMBER_OF_POOLS>::addData(
|
||||
store_address_t* storageId, const uint8_t* data, size_t size,
|
||||
bool ignoreFault) {
|
||||
ReturnValue_t status = reserveSpace(size, storageId, ignoreFault);
|
||||
if (status == RETURN_OK) {
|
||||
write(*storageId, data, size);
|
||||
@ -171,7 +172,7 @@ inline ReturnValue_t LocalPool<NUMBER_OF_POOLS>::getData(store_address_t storeId
|
||||
template<uint8_t NUMBER_OF_POOLS>
|
||||
inline ReturnValue_t LocalPool<NUMBER_OF_POOLS>::getData(
|
||||
store_address_t packet_id, const uint8_t** packet_ptr, size_t* size) {
|
||||
uint8_t* tempData = NULL;
|
||||
uint8_t* tempData = nullptr;
|
||||
ReturnValue_t status = modifyData(packet_id, &tempData, size);
|
||||
*packet_ptr = tempData;
|
||||
return status;
|
||||
@ -301,4 +302,4 @@ inline ReturnValue_t LocalPool<NUMBER_OF_POOLS>::initialize() {
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* FSFW_STORAGEMANAGER_LOCALPOOL_TPP_ */
|
||||
|
@ -1,9 +1,10 @@
|
||||
#ifndef FRAMEWORK_STORAGEMANAGER_POOLMANAGER_H_
|
||||
#define FRAMEWORK_STORAGEMANAGER_POOLMANAGER_H_
|
||||
#ifndef FSFW_STORAGEMANAGER_POOLMANAGER_H_
|
||||
#define FSFW_STORAGEMANAGER_POOLMANAGER_H_
|
||||
|
||||
#include "../storagemanager/LocalPool.h"
|
||||
#include "LocalPool.h"
|
||||
#include "StorageAccessor.h"
|
||||
#include "../ipc/MutexHelper.h"
|
||||
#include "../storagemanager/StorageAccessor.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief The PoolManager class provides an intermediate data storage with
|
||||
@ -19,18 +20,24 @@ public:
|
||||
const uint16_t element_sizes[NUMBER_OF_POOLS],
|
||||
const uint16_t n_elements[NUMBER_OF_POOLS]);
|
||||
|
||||
//! @brief In the PoolManager's destructor all allocated memory is freed.
|
||||
/**
|
||||
* @brief In the PoolManager's destructor all allocated memory
|
||||
* is freed.
|
||||
*/
|
||||
virtual ~PoolManager();
|
||||
|
||||
//! @brief LocalPool overrides for thread-safety. Decorator function which
|
||||
//! wraps LocalPool calls with a mutex protection.
|
||||
/**
|
||||
* @brief LocalPool overrides for thread-safety. Decorator function
|
||||
* which wraps LocalPool calls with a mutex protection.
|
||||
*/
|
||||
ReturnValue_t deleteData(store_address_t) override;
|
||||
ReturnValue_t deleteData(uint8_t* buffer, size_t size,
|
||||
store_address_t* storeId = nullptr) override;
|
||||
|
||||
void setMutexTimeout(uint32_t mutexTimeoutMs);
|
||||
protected:
|
||||
//! Default mutex timeout value to prevent permanent blocking.
|
||||
static constexpr uint32_t mutexTimeout = 50;
|
||||
uint32_t mutexTimeoutMs = 20;
|
||||
|
||||
ReturnValue_t reserveSpace(const uint32_t size, store_address_t* address,
|
||||
bool ignoreFault) override;
|
||||
@ -46,4 +53,4 @@ protected:
|
||||
|
||||
#include "PoolManager.tpp"
|
||||
|
||||
#endif /* POOLMANAGER_H_ */
|
||||
#endif /* FSFW_STORAGEMANAGER_POOLMANAGER_H_ */
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef FRAMEWORK_STORAGEMANAGER_POOLMANAGER_TPP_
|
||||
#define FRAMEWORK_STORAGEMANAGER_POOLMANAGER_TPP_
|
||||
|
||||
#ifndef FRAMEWORK_STORAGEMANAGER_POOLMANAGER_H_
|
||||
#ifndef FSFW_STORAGEMANAGER_POOLMANAGER_H_
|
||||
#error Include PoolManager.h before PoolManager.tpp!
|
||||
#endif
|
||||
|
||||
@ -21,8 +21,7 @@ inline PoolManager<NUMBER_OF_POOLS>::~PoolManager(void) {
|
||||
template<uint8_t NUMBER_OF_POOLS>
|
||||
inline ReturnValue_t PoolManager<NUMBER_OF_POOLS>::reserveSpace(
|
||||
const uint32_t size, store_address_t* address, bool ignoreFault) {
|
||||
MutexHelper mutexHelper(mutex, MutexIF::TimeoutType::WAITING,
|
||||
mutexTimeout);
|
||||
MutexHelper mutexHelper(mutex,MutexIF::WAITING, mutexTimeoutMs);
|
||||
ReturnValue_t status = LocalPool<NUMBER_OF_POOLS>::reserveSpace(size,
|
||||
address,ignoreFault);
|
||||
return status;
|
||||
@ -34,8 +33,7 @@ inline ReturnValue_t PoolManager<NUMBER_OF_POOLS>::deleteData(
|
||||
// debug << "PoolManager( " << translateObject(getObjectId()) <<
|
||||
// " )::deleteData from store " << packet_id.pool_index <<
|
||||
// ". id is "<< packet_id.packet_index << std::endl;
|
||||
MutexHelper mutexHelper(mutex, MutexIF::TimeoutType::WAITING,
|
||||
mutexTimeout);
|
||||
MutexHelper mutexHelper(mutex,MutexIF::WAITING, mutexTimeoutMs);
|
||||
ReturnValue_t status = LocalPool<NUMBER_OF_POOLS>::deleteData(packet_id);
|
||||
return status;
|
||||
}
|
||||
@ -43,11 +41,16 @@ inline ReturnValue_t PoolManager<NUMBER_OF_POOLS>::deleteData(
|
||||
template<uint8_t NUMBER_OF_POOLS>
|
||||
inline ReturnValue_t PoolManager<NUMBER_OF_POOLS>::deleteData(uint8_t* buffer,
|
||||
size_t size, store_address_t* storeId) {
|
||||
MutexHelper mutexHelper(mutex, MutexIF::TimeoutType::WAITING,
|
||||
mutexTimeout);
|
||||
MutexHelper mutexHelper(mutex,MutexIF::WAITING, mutexTimeoutMs);
|
||||
ReturnValue_t status = LocalPool<NUMBER_OF_POOLS>::deleteData(buffer,
|
||||
size, storeId);
|
||||
return status;
|
||||
}
|
||||
|
||||
#endif
|
||||
template<uint8_t NUMBER_OF_POOLS>
|
||||
inline void PoolManager<NUMBER_OF_POOLS>::setMutexTimeout(
|
||||
uint32_t mutexTimeoutMs) {
|
||||
this->mutexTimeout = mutexTimeoutMs;
|
||||
}
|
||||
|
||||
#endif /* FRAMEWORK_STORAGEMANAGER_POOLMANAGER_TPP_ */
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "../storagemanager/StorageAccessor.h"
|
||||
#include "../storagemanager/StorageManagerIF.h"
|
||||
#include "StorageAccessor.h"
|
||||
#include "StorageManagerIF.h"
|
||||
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||
|
||||
StorageAccessor::StorageAccessor(store_address_t storeId):
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef FRAMEWORK_STORAGEMANAGER_STORAGEACCESSOR_H_
|
||||
#define FRAMEWORK_STORAGEMANAGER_STORAGEACCESSOR_H_
|
||||
#ifndef FSFW_STORAGEMANAGER_STORAGEACCESSOR_H_
|
||||
#define FSFW_STORAGEMANAGER_STORAGEACCESSOR_H_
|
||||
|
||||
#include "../storagemanager/ConstStorageAccessor.h"
|
||||
#include "ConstStorageAccessor.h"
|
||||
|
||||
class StorageManagerIF;
|
||||
|
||||
@ -42,4 +42,4 @@ private:
|
||||
void assignConstPointer();
|
||||
};
|
||||
|
||||
#endif /* TEST_PROTOTYPES_STORAGEACCESSOR_H_ */
|
||||
#endif /* FSFW_STORAGEMANAGER_STORAGEACCESSOR_H_ */
|
||||
|
@ -1,10 +1,12 @@
|
||||
#ifndef STORAGEMANAGERIF_H_H
|
||||
#define STORAGEMANAGERIF_H_H
|
||||
#ifndef FSFW_STORAGEMANAGER_STORAGEMANAGERIF_H_
|
||||
#define FSFW_STORAGEMANAGER_STORAGEMANAGERIF_H_
|
||||
|
||||
#include "StorageAccessor.h"
|
||||
#include "storeAddress.h"
|
||||
|
||||
#include "../events/Event.h"
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
#include "../storagemanager/StorageAccessor.h"
|
||||
#include "../storagemanager/storeAddress.h"
|
||||
|
||||
#include <utility>
|
||||
#include <cstddef>
|
||||
|
||||
@ -164,4 +166,4 @@ public:
|
||||
virtual void clearStore() = 0;
|
||||
};
|
||||
|
||||
#endif /* STORAGEMANAGERIF_H_ */
|
||||
#endif /* FSFW_STORAGEMANAGER_STORAGEMANAGERIF_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user