took over imrpvements

This commit is contained in:
Robin Müller 2020-06-23 11:06:54 +02:00
parent 4c59b043e1
commit a589be7c74
5 changed files with 14 additions and 17 deletions

View File

@ -1,6 +1,7 @@
#include <framework/storagemanager/ConstStoreAccessor.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
#include <framework/storagemanager/ConstStorageAccessor.h>
#include <framework/storagemanager/StorageManagerIF.h>
#include <framework/globalfunctions/arrayprinter.h>
ConstStorageAccessor::ConstStorageAccessor(store_address_t storeId):
storeId(storeId) {}
@ -73,18 +74,11 @@ store_address_t ConstStorageAccessor::getId() const {
}
void ConstStorageAccessor::print() const {
if(internalState == AccessState::UNINIT) {
if(internalState == AccessState::UNINIT or constDataPointer == nullptr) {
sif::warning << "StorageAccessor: Not initialized!" << std::endl;
return;
}
sif::info << "StorageAccessor: Printing data: [";
for(uint16_t iPool = 0; iPool < size_; iPool++) {
sif::info << std::hex << (int)constDataPointer[iPool];
if(iPool < size_ - 1){
sif::info << " , ";
}
}
sif::info << " ] " << std::endl;
arrayprinter::print(constDataPointer, size_);
}
void ConstStorageAccessor::assignStore(StorageManagerIF* store) {

View File

@ -1,5 +1,5 @@
#ifndef FRAMEWORK_STORAGEMANAGER_CONSTSTOREACCESSOR_H_
#define FRAMEWORK_STORAGEMANAGER_CONSTSTOREACCESSOR_H_
#ifndef FRAMEWORK_STORAGEMANAGER_CONSTSTORAGEACCESSOR_H_
#define FRAMEWORK_STORAGEMANAGER_CONSTSTORAGEACCESSOR_H_
#include <framework/storagemanager/storeAddress.h>
#include <framework/returnvalues/HasReturnvaluesIF.h>
@ -113,4 +113,4 @@ protected:
};
#endif /* FRAMEWORK_STORAGEMANAGER_CONSTSTOREACCESSOR_H_ */
#endif /* FRAMEWORK_STORAGEMANAGER_CONSTSTORAGEACCESSOR_H_ */

View File

@ -29,6 +29,9 @@ public:
store_address_t* storeId = nullptr) override;
protected:
//! Default mutex timeout value to prevent permanent blocking.
static constexpr uint32_t mutexTimeout = 50;
ReturnValue_t reserveSpace(const uint32_t size, store_address_t* address,
bool ignoreFault) override;

View File

@ -21,7 +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::NO_TIMEOUT);
MutexHelper mutexHelper(mutex, mutexTimeout);
ReturnValue_t status = LocalPool<NUMBER_OF_POOLS>::reserveSpace(size,
address,ignoreFault);
return status;
@ -33,7 +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::NO_TIMEOUT);
MutexHelper mutexHelper(mutex, mutexTimeout);
ReturnValue_t status = LocalPool<NUMBER_OF_POOLS>::deleteData(packet_id);
return status;
}
@ -41,7 +41,7 @@ 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::NO_TIMEOUT);
MutexHelper mutexHelper(mutex, mutexTimeout);
ReturnValue_t status = LocalPool<NUMBER_OF_POOLS>::deleteData(buffer,
size, storeId);
return status;

View File

@ -1,7 +1,7 @@
#ifndef FRAMEWORK_STORAGEMANAGER_STORAGEACCESSOR_H_
#define FRAMEWORK_STORAGEMANAGER_STORAGEACCESSOR_H_
#include <framework/storagemanager/ConstStoreAccessor.h>
#include <framework/storagemanager/ConstStorageAccessor.h>
class StorageManagerIF;