improved naming convention

This commit is contained in:
Robin Müller 2021-01-18 20:03:03 +01:00
parent 6e6e1304bb
commit 74def820c6
3 changed files with 33 additions and 16 deletions

View File

@ -348,16 +348,20 @@ void LocalPool::getFillCount(uint8_t *buffer, uint8_t *bytesWritten) {
}
void LocalPool::clearPage(max_pools_t pageIndex) {
if(pageIndex >= NUMBER_OF_POOLS) {
void LocalPool::clearPool(max_pools_t poolIndex) {
if(poolIndex >= NUMBER_OF_POOLS) {
return;
}
// Mark the storage as free
for(auto& size: sizeLists[pageIndex]) {
for(auto& size: sizeLists[poolIndex]) {
size = STORAGE_FREE;
}
// Set all the page content to 0.
std::memset(store[pageIndex].data(), 0, elementSizes[pageIndex]);
std::memset(store[poolIndex].data(), 0, elementSizes[poolIndex]);
}
LocalPool::max_pools_t LocalPool::getNumberOfPools() const {
return NUMBER_OF_POOLS;
}

View File

@ -60,15 +60,6 @@ public:
};
using LocalPoolConfig = std::multiset<LocalPoolCfgPair, LocalPoolConfigCmp>;
/**
* @brief This definition generally sets the number of
* different sized pools. It is derived from the number of pairs
* inside the LocalPoolConfig set on object creation.
* @details
* This must be less than the maximum number of pools (currently 0xff).
*/
const max_pools_t NUMBER_OF_POOLS;
/**
* @brief This is the default constructor for a pool manager instance.
* @details
@ -143,9 +134,15 @@ public:
void getFillCount(uint8_t* buffer, uint8_t* bytesWritten) override;
void clearStore() override;
void clearPage(max_pools_t pageIndex) override;
void clearPool(max_pools_t poolIndex) override;
ReturnValue_t initialize() override;
/**
* Get number pools. Each pool has pages with a specific bucket size.
* @return
*/
max_pools_t getNumberOfPools() const override;
protected:
/**
* With this helper method, a free element of @c size is reserved.
@ -158,6 +155,16 @@ protected:
store_address_t* address, bool ignoreFault);
private:
/**
* @brief This definition generally sets the number of
* different sized pools. It is derived from the number of pairs
* inside the LocalPoolConfig set on object creation.
* @details
* This must be less than the maximum number of pools (currently 0xff).
*/
const max_pools_t NUMBER_OF_POOLS;
/**
* Indicates that this element is free.
* This value limits the maximum size of a pool.

View File

@ -171,10 +171,10 @@ public:
virtual void clearStore() = 0;
/**
* Clears a page in the store. Use with care!
* Clears a pool in the store with the given pool index. Use with care!
* @param pageIndex
*/
virtual void clearPage(uint8_t pageIndex) = 0;
virtual void clearPool(uint8_t poolIndex) = 0;
/**
* Get the fill count of the pool. The exact form will be implementation
@ -185,6 +185,12 @@ public:
virtual void getFillCount(uint8_t* buffer, uint8_t* bytesWritten) = 0;
virtual size_t getTotalSize(size_t* additionalSize) = 0;
/**
* Get number of pools.
* @return
*/
virtual max_pools_t getNumberOfPools() const = 0;
};
#endif /* FSFW_STORAGEMANAGER_STORAGEMANAGERIF_H_ */