template<class Titem, typename Tindex, size_t Tgrowth_step, size_t Tmax_size, PoolType Tpool_type = PT_NORMAL, bool Tcache = false, bool Tzero = true>
struct Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >
Base class for all pools.
- Template Parameters
-
Titem | Type of the class/struct that is going to be pooled |
Tindex | Type of the index for this pool |
Tgrowth_step | Size of growths; if the pool is full increase the size by this amount |
Tmax_size | Maximum size of the pool |
Tpool_type | Type of this pool |
Tcache | Whether to perform 'alloc' caching, i.e. don't actually free/malloc just reuse the memory |
Tzero | Whether to zero the memory |
- Warning
- when Tcache is enabled all instances of this pool's item must be of the same size.
Definition at line 83 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>
bool Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::CanAllocate |
( |
size_t |
n = 1 | ) |
|
|
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>
Titem* Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::Get |
( |
size_t |
index | ) |
|
|
inline |
Returns Titem with given index.
- Parameters
-
- Returns
- pointer to Titem
- Precondition
- index < this->first_unused
Definition at line 111 of file pool_type.hpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::data, and Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::first_unused.
Referenced by StoryBookWindow::GetSelPage(), and Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::IsValidID().
template<class Titem , typename Tindex , size_t Tgrowth_step, size_t Tmax_size, PoolType Tpool_type = PT_NORMAL, bool Tcache = false, bool Tzero = true>
bool Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::IsValidID |
( |
size_t |
index | ) |
|
|
inline |
Tests whether given index can be used to get valid (non-NULL) Titem.
- Parameters
-
- Returns
- true if PoolItem::Get(index) will return non-NULL pointer
Definition at line 122 of file pool_type.hpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::first_unused, and Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::Get().
Referenced by StoryBookWindow::GetSelPage(), StoryBookWindow::IsFirstPageSelected(), StoryBookWindow::IsLastPageSelected(), StoryBookWindow::OnInvalidateData(), StoryBookWindow::SelectNextPage(), and StoryBookWindow::SelectPrevPage().