27 #ifndef EMBB_CONTAINERS_LOCK_FREE_TREE_VALUE_POOL_H_ 28 #define EMBB_CONTAINERS_LOCK_FREE_TREE_VALUE_POOL_H_ 30 #include <embb/base/atomic.h> 31 #include <embb/base/memory_allocation.h> 36 namespace containers {
52 template<
typename Type,
143 PoolAllocator pool_allocator_;
146 TreeAllocator tree_allocator_;
153 static int GetSmallestPowerByTwoValue(
int value);
181 int GetLeftChildIndex(
192 int GetRightChildIndex(
201 int NodeIndexToPoolIndex(
210 int PoolIndexToNodeIndex(
int index);
269 std::forward_iterator_tag, std::pair<int, Type> > {
381 template<
typename ForwardIterator>
383 ForwardIterator first,
444 #include <embb/containers/internal/lock_free_tree_value_pool-inl.h> 446 #endif // EMBB_CONTAINERS_LOCK_FREE_TREE_VALUE_POOL_H_ Definition: lock_free_mpmc_queue.h:40
~LockFreeTreeValuePool()
Destructs the pool.
bool operator!=(Iterator const &rhs)
Compares two iterators for inequality.
Iterator & operator=(Iterator const &other)
Copies an iterator.
Forward iterator to iterate over the allocated elements of the pool.
Definition: lock_free_tree_value_pool.h:268
int Allocate(Type &element)
Allocates an element from the pool.
Lock-free value pool using binary tree construction.
Definition: lock_free_tree_value_pool.h:57
Allocator according to the C++ standard.
Definition: memory_allocation.h:525
void Free(Type element, int index)
Returns an element to the pool.
Iterator Begin()
Gets a forward iterator to the first allocated element in the pool.
static size_t GetMinimumElementCountForGuaranteedCapacity(size_t capacity)
Due to concurrency effects, a pool might provide less elements than managed by it.
Iterator & operator++()
Pre-increments an iterator.
bool operator==(Iterator const &rhs)
Compares two iterators for equality.
Iterator()
Constructs an invalid iterator.
Iterator End()
Gets a forward iterator pointing after the last allocated element in the pool.
std::pair< int, Type > operator*()
Dereferences the iterator.