|
Foundation
|
Atomic, bounded object pool with O(1) value mapping. More...
#include <Pool.hpp>
Public Member Functions | |
| Pool (size_t size, Allocator *alloc) | |
| Constructs a FreeList with the specified capacity and allocator. | |
| bool | Contains (K key) const |
| Checks if the specified key exists and has a value. | |
| V & | At (K key) |
| Retrieves a reference to the value associated with the given key. NOTE: Calling this function with a key that's not retrieved from pop() is undefined behavior. | |
| V const & | At (K key) const |
| Retrieves a const reference to the value associated with the given key. | |
| const K | Pop () |
| const Pair< K, V & > | PopPair () |
| Allocates a Key that returns a pair of key and value reference. | |
| void | Free (K key) |
| Frees the value associated with the specified key. | |
Private Attributes | |
| const size_t | mCapacity |
| MPMCQueue< K > | mKeys |
| Vector< V > | mValues |
| Vector< char > | mBitmap |
Atomic, bounded object pool with O(1) value mapping.
| K | Key type. Should be an integral type. |
| V | Value type. |
| Tombstone | Tombstone value type for erased values. |
Constructs a FreeList with the specified capacity and allocator.
| size | The maximum number of elements the FreeList can hold, which will be pre-allocated. |
| alloc | Allocator to use for internal allocations. |
Retrieves a reference to the value associated with the given key. NOTE: Calling this function with a key that's not retrieved from pop() is undefined behavior.
Retrieves a const reference to the value associated with the given key.
Checks if the specified key exists and has a value.
Frees the value associated with the specified key.
Allocates a Key that returns a pair of key and value reference.