fixed map and local pool doc

This commit is contained in:
Robin Müller 2019-12-08 22:26:42 +01:00
parent d99ed47150
commit 3159ccbc40
2 changed files with 11 additions and 2 deletions

View File

@ -6,8 +6,10 @@
#include <utility> #include <utility>
/** /**
* @brief Implementation of a fixed map using an array list * @brief Map implementation for maps with a pre-defined size.
* @details Initialize with desired fixed size * @details Can be initialized with desired maximum size.
* Iterator is used to access <key,value> pair and
* iterate through map entries.
* @ingroup container * @ingroup container
*/ */
template<typename key_t, typename T> template<typename key_t, typename T>
@ -54,19 +56,24 @@ public:
return ArrayList<std::pair<key_t, T>, uint32_t>::Iterator::value->second; return ArrayList<std::pair<key_t, T>, uint32_t>::Iterator::value->second;
} }
// -> operator overloaded, can be used to access value
T *operator->() { T *operator->() {
return &ArrayList<std::pair<key_t, T>, uint32_t>::Iterator::value->second; return &ArrayList<std::pair<key_t, T>, uint32_t>::Iterator::value->second;
} }
// Can be used to access the key of the iterator
key_t first() { key_t first() {
return ArrayList<std::pair<key_t, T>, uint32_t>::Iterator::value->first; return ArrayList<std::pair<key_t, T>, uint32_t>::Iterator::value->first;
} }
// Alternative to access value, similar to std::map implementation
T second() { T second() {
return ArrayList<std::pair<key_t, T>, uint32_t>::Iterator::value->second; return ArrayList<std::pair<key_t, T>, uint32_t>::Iterator::value->second;
} }
}; };
Iterator begin() const { Iterator begin() const {
return Iterator(&theMap[0]); return Iterator(&theMap[0]);
} }

View File

@ -149,6 +149,8 @@ public:
* 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. 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, LocalPool(object_id_t setObjectId,
const uint16_t element_sizes[NUMBER_OF_POOLS], const uint16_t element_sizes[NUMBER_OF_POOLS],