Nebula
|
#include <fixedpool.h>
Implements a fixed size pool, from which objects of a specific type can be allocated and freed for reuse.
Public Types | |
typedef TYPE * | Iterator |
define iterator | |
Public Member Functions | |
FixedPool () | |
default constructor | |
FixedPool (SizeT s, std::function< void(TYPE &val, IndexT idx)> setupFunc) | |
constructor with fixed size | |
~FixedPool () | |
destructor | |
void | operator= (const FixedArray< TYPE > &rhs) |
assignment operator | |
TYPE & | operator[] (const IndexT elem) |
access operator | |
TYPE & | Alloc () |
allocate an element in the pool | |
void | Free (const TYPE &elem) |
free element allocated from pool | |
void | Free (const Iterator iter) |
free element using iterator | |
SizeT | Size () const |
get number of elements | |
SizeT | NumFree () const |
get number of free elements | |
SizeT | NumUsed () const |
get number of used elements | |
void | Resize (SizeT newSize) |
reset pool and resize pool | |
bool | IsFull () const |
returns true if no more free values are available | |
bool | IsEmpty () const |
returns true if the pool is empty | |
void | Clear () |
clear all pool values | |
void | Reset () |
resets all used indices without clearing contents | |
void | SetSetupFunc (const std::function< void(TYPE &val, IndexT idx)> &func) |
set optional setup value | |
const Util::Array< TYPE > & | GetAllocated () |
get allocated values as array | |
Private Attributes | |
std::function< void(TYPE &val, IndexT idx)> | setupFunc |
SizeT | size |
Util::Array< TYPE > | freeValues |
Util::Array< TYPE > | usedValues |
typedef TYPE* Util::FixedPool< TYPE >::Iterator |
define iterator
|
inline |
default constructor
|
inline |
constructor with fixed size
|
inline |
destructor
|
inline |
allocate an element in the pool
|
inline |
clear all pool values
|
inline |
free element using iterator
|
inline |
free element allocated from pool
|
inline |
get allocated values as array
|
inline |
returns true if the pool is empty
|
inline |
returns true if no more free values are available
|
inline |
get number of free elements
|
inline |
get number of used elements
|
inline |
assignment operator
TYPE & Util::FixedPool< TYPE >::operator[] | ( | const IndexT | elem | ) |
access operator
|
inline |
resets all used indices without clearing contents
|
inline |
reset pool and resize pool
|
inline |
set optional setup value
|
inline |
get number of elements
|
private |
|
private |
|
private |
|
private |