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

View File

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

View File

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

View File

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