106 n_assert2((
uint)(oldCapacity + growTo) < this->
maxId,
"Pool is full! Be careful with how much you allocate!\n");
111 for (i = this->
free.
Capacity()-1; i >= oldCapacity; i--)
139 this->
maxId = numIds;
141 for (
int i = numIds - 1; i >= 0; i--)
172 for (
IndexT i = size - 1; i >= 0; i--)
~IdPool()
destructor
Definition idpool.h:87
void Move(uint lhs, uint rhs)
frees up lhs and erases rhs
Definition idpool.h:187
Util::Array< uint > free
Definition idpool.h:56
IdPool()
constructor
Definition idpool.h:65
uint GetNumFree() const
get number of free elements
Definition idpool.h:160
const uint GetGrow() const
get grow
Definition idpool.h:197
uint maxId
Definition idpool.h:57
uint GetNumUsed() const
get number of active ids
Definition idpool.h:151
void ForEachFree(const std::function< void(uint, uint)> fun, SizeT num)
iterate free indices
Definition idpool.h:169
uint Alloc()
get new id
Definition idpool.h:96
uint grow
Definition idpool.h:58
void Reserve(uint numIds)
reserve ids
Definition idpool.h:137
void Dealloc(uint id)
free id
Definition idpool.h:128
Nebula's dynamic array class.
Definition array.h:60
void Reserve(SizeT num)
increase capacity to fit N more elements into the array.
Definition array.h:862
TYPE & Back() const
return reference to last element
Definition array.h:993
const SizeT Capacity() const
get overall allocated size of array in number of elements
Definition array.h:900
void Append(const TYPE &first, const ELEM_TYPE &... elements)
Append multiple elements to the end of the array.
Definition array.h:1334
void EraseIndex(IndexT index)
erase element at index, keep sorting intact
Definition array.h:1036
const SizeT Size() const
get number of elements in array
Definition array.h:880
#define n_assert2(exp, msg)
Definition debug.h:51
This simple Id pool implements a set of free and used consecutive integers.
Definition id.h:135
__forceinline TYPE min(TYPE a, TYPE b)
Definition scalar.h:390
Nebula's scalar datatype.
int SizeT
Definition types.h:49
unsigned int uint
Definition types.h:31
int IndexT
Definition types.h:48