store access improvements

This commit is contained in:
Robin Müller 2020-06-04 14:43:33 +02:00
parent 925a54dec9
commit a115bf1186
4 changed files with 9 additions and 8 deletions

View File

@ -24,7 +24,6 @@
* The local pool is NOT thread-safe.
* @author Bastian Baetz
*/
template<uint8_t NUMBER_OF_POOLS = 5>
class LocalPool: public SystemObject, public StorageManagerIF {
public:
@ -48,9 +47,10 @@ public:
* number of elements for each pool is determined.
* The position of these values correspond to those in
* element_sizes.
* @param registered Register the pool in object manager or not. Default is false (local pool).
* @param spillsToHigherPools
* A variable to determine whether higher n pools are used if the store is full.
* @param registered Register the pool in object manager or not.
* Default is false (local pool).
* @param spillsToHigherPools A variable to determine whether
* higher n pools are used if the store is full.
*/
LocalPool(object_id_t setObjectId,
const uint16_t element_sizes[NUMBER_OF_POOLS],
@ -117,7 +117,7 @@ private:
/**
* @brief store represents the actual memory pool.
* @details It is an array of pointers to memory, which was allocated with
* a \c new call on construction.
* a @c new call on construction.
*/
uint8_t* store[NUMBER_OF_POOLS];
/**

View File

@ -12,7 +12,7 @@
* with a lock.
* @author Bastian Baetz
*/
template <uint8_t NUMBER_OF_POOLS>
template <uint8_t NUMBER_OF_POOLS = 5>
class PoolManager : public LocalPool<NUMBER_OF_POOLS> {
public:
PoolManager(object_id_t setObjectId,
@ -27,6 +27,7 @@ public:
ReturnValue_t deleteData(store_address_t) override;
ReturnValue_t deleteData(uint8_t* buffer, size_t size,
store_address_t* storeId = nullptr) override;
protected:
ReturnValue_t reserveSpace(const uint32_t size, store_address_t* address,
bool ignoreFault) override;

View File

@ -48,4 +48,3 @@ inline ReturnValue_t PoolManager<NUMBER_OF_POOLS>::deleteData(uint8_t* buffer,
}
#endif

View File

@ -11,7 +11,6 @@
using AccessorPair = std::pair<ReturnValue_t, StorageAccessor>;
using ConstAccessorPair = std::pair<ReturnValue_t, ConstStorageAccessor>;
/**
* @brief This class provides an interface for intermediate data storage.
* @details The Storage manager classes shall be used to store larger chunks of
@ -80,6 +79,7 @@ public:
virtual ReturnValue_t deleteData(uint8_t* buffer, size_t size,
store_address_t* storeId = nullptr) = 0;
/**
* @brief Access the data by supplying a store ID.
* @details
@ -100,6 +100,7 @@ public:
virtual ReturnValue_t getData(store_address_t storeId,
ConstStorageAccessor& constAccessor) = 0;
/**
* @brief getData returns an address to data and the size of the data
* for a given packet_id.