template<class Titem, typename Tindex, size_t Tgrowth_step, size_t Tmax_size, PoolType Tpool_type = PT_NORMAL, bool Tcache = false, bool Tzero = true>
template<struct Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero > * Tpool>
struct Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >
Base class for all PoolItems.
- Template Parameters
-
Tpool | The pool this item is going to be part of |
Definition at line 237 of file pool_type.hpp.
template<class Titem , typename Tindex , size_t Tgrowth_step, size_t Tmax_size, PoolType Tpool_type = PT_NORMAL, bool Tcache = false, bool Tzero = true>
template<struct Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero > * Tpool>
static bool Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::CanAllocateItem |
( |
size_t |
n = 1 | ) |
|
|
inlinestatic |
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function()
Tests whether we can allocate 'n' items
- Parameters
-
n | number of items we want to allocate |
- Returns
- true if 'n' items can be allocated
Definition at line 309 of file pool_type.hpp.
template<class Titem , typename Tindex , size_t Tgrowth_step, size_t Tmax_size, PoolType Tpool_type = PT_NORMAL, bool Tcache = false, bool Tzero = true>
template<struct Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero > * Tpool>
static bool Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::CleaningPool |
( |
| ) |
|
|
inlinestatic |
Returns current state of pool cleaning - yes or no.
- Returns
- true iff we are cleaning the pool now
Definition at line 318 of file pool_type.hpp.
template<class Titem , typename Tindex , size_t Tgrowth_step, size_t Tmax_size, PoolType Tpool_type = PT_NORMAL, bool Tcache = false, bool Tzero = true>
template<struct Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero > * Tpool>
static Titem* Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::Get |
( |
size_t |
index | ) |
|
|
inlinestatic |
template<class Titem , typename Tindex , size_t Tgrowth_step, size_t Tmax_size, PoolType Tpool_type = PT_NORMAL, bool Tcache = false, bool Tzero = true>
template<struct Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero > * Tpool>
static Titem* Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::GetIfValid |
( |
size_t |
index | ) |
|
|
inlinestatic |
template<class Titem , typename Tindex , size_t Tgrowth_step, size_t Tmax_size, PoolType Tpool_type = PT_NORMAL, bool Tcache = false, bool Tzero = true>
template<struct Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero > * Tpool>
static size_t Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::GetNumItems |
( |
| ) |
|
|
inlinestatic |
Returns number of valid items in the pool.
- Returns
- number of valid items in the pool
Definition at line 369 of file pool_type.hpp.
template<class Titem , typename Tindex , size_t Tgrowth_step, size_t Tmax_size, PoolType Tpool_type = PT_NORMAL, bool Tcache = false, bool Tzero = true>
template<struct Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero > * Tpool>
static size_t Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::GetPoolSize |
( |
| ) |
|
|
inlinestatic |
Returns first unused index.
Useful when iterating over all pool items.
- Returns
- first unused index
Definition at line 360 of file pool_type.hpp.
template<class Titem , typename Tindex , size_t Tgrowth_step, size_t Tmax_size, PoolType Tpool_type = PT_NORMAL, bool Tcache = false, bool Tzero = true>
template<struct Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero > * Tpool>
static bool Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::IsValidID |
( |
size_t |
index | ) |
|
|
inlinestatic |
template<class Titem , typename Tindex , size_t Tgrowth_step, size_t Tmax_size, PoolType Tpool_type = PT_NORMAL, bool Tcache = false, bool Tzero = true>
template<struct Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero > * Tpool>
Returns an iterable ensemble of all valid Titem.
- Parameters
-
from | index of the first Titem to consider |
- Returns
- an iterable ensemble of all valid Titem
Definition at line 388 of file pool_type.hpp.
template<class Titem , typename Tindex , size_t Tgrowth_step, size_t Tmax_size, PoolType Tpool_type = PT_NORMAL, bool Tcache = false, bool Tzero = true>
template<struct Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero > * Tpool>
void Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::operator delete |
( |
void * |
p | ) |
|
|
inline |
Marks Titem as free.
Its memory is released
- Parameters
-
- Note
- the item has to be allocated in the pool!
Definition at line 259 of file pool_type.hpp.
template<class Titem , typename Tindex , size_t Tgrowth_step, size_t Tmax_size, PoolType Tpool_type = PT_NORMAL, bool Tcache = false, bool Tzero = true>
template<struct Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero > * Tpool>
void* Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::operator new |
( |
size_t |
size | ) |
|
|
inline |
template<class Titem , typename Tindex , size_t Tgrowth_step, size_t Tmax_size, PoolType Tpool_type = PT_NORMAL, bool Tcache = false, bool Tzero = true>
template<struct Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero > * Tpool>
void* Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::operator new |
( |
size_t |
size, |
|
|
size_t |
index |
|
) |
| |
|
inline |
Allocates space for new Titem with given index.
- Parameters
-
size | size of Titem |
index | index of item |
- Returns
- pointer to allocated memory
- Note
- can never fail (return nullptr), use CanAllocate() to check first!
- Precondition
- index has to be unused! Else it will crash
Definition at line 275 of file pool_type.hpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, and Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::size.
template<class Titem , typename Tindex , size_t Tgrowth_step, size_t Tmax_size, PoolType Tpool_type = PT_NORMAL, bool Tcache = false, bool Tzero = true>
template<struct Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero > * Tpool>
void* Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::operator new |
( |
size_t |
, |
|
|
void * |
ptr |
|
) |
| |
|
inline |
Allocates space for new Titem at given memory address.
- Parameters
-
ptr | where are we allocating the item? |
- Returns
- pointer to allocated memory (== ptr)
- Note
- use of this is strongly discouraged
- Precondition
- the memory must not be allocated in the Pool!
Definition at line 287 of file pool_type.hpp.
template<class Titem , typename Tindex , size_t Tgrowth_step, size_t Tmax_size, PoolType Tpool_type = PT_NORMAL, bool Tcache = false, bool Tzero = true>
template<struct Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero > * Tpool>
static void Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::PostDestructor |
( |
[[maybe_unused] ] size_t |
index | ) |
|
|
inlinestatic |
Dummy function called after destructor of each member.
If you want to use it, override it in PoolItem's subclass.
- Parameters
-
index | index of deleted item |
- Note
- when this function is called, PoolItem::Get(index) == nullptr.
-
it's called only when !CleaningPool()
Definition at line 381 of file pool_type.hpp.