Nebula
Loading...
Searching...
No Matches
Ids::IdPool Class Reference

#include <idpool.h>

Public Member Functions

 IdPool ()
 constructor
 IdPool (const uint max, const uint grow=512)
 constructor with maximum size
 ~IdPool ()
 destructor
uint Alloc ()
 get new id
void Dealloc (uint id)
 free id
void Reserve (uint numIds)
 reserve ids
uint GetNumUsed () const
 get number of active ids
uint GetNumFree () const
 get number of free elements
void ForEachFree (const std::function< void(uint, uint)> fun, SizeT num)
 iterate free indices
void Move (uint lhs, uint rhs)
 frees up lhs and erases rhs
const uint GetGrow () const
 get grow

Private Attributes

Util::Array< uintfree
uint maxId
uint grow

Constructor & Destructor Documentation

◆ IdPool() [1/2]

Ids::IdPool::IdPool ( )
inline

constructor

◆ IdPool() [2/2]

Ids::IdPool::IdPool ( const uint max,
const uint grow = 512 )
inline

constructor with maximum size

◆ ~IdPool()

Ids::IdPool::~IdPool ( )
inline

destructor

Member Function Documentation

◆ Alloc()

uint Ids::IdPool::Alloc ( )
inline

get new id

◆ Dealloc()

void Ids::IdPool::Dealloc ( uint id)
inline

free id

◆ ForEachFree()

void Ids::IdPool::ForEachFree ( const std::function< void(uint, uint)> fun,
SizeT num )
inline

iterate free indices

◆ GetGrow()

const uint Ids::IdPool::GetGrow ( ) const
inline

get grow

◆ GetNumFree()

uint Ids::IdPool::GetNumFree ( ) const
inline

get number of free elements

◆ GetNumUsed()

uint Ids::IdPool::GetNumUsed ( ) const
inline

get number of active ids

◆ Move()

void Ids::IdPool::Move ( uint lhs,
uint rhs )
inline

frees up lhs and erases rhs

◆ Reserve()

void Ids::IdPool::Reserve ( uint numIds)
inline

reserve ids

Member Data Documentation

◆ free

Util::Array<uint> Ids::IdPool::free
private

◆ grow

uint Ids::IdPool::grow
private

◆ maxId

uint Ids::IdPool::maxId
private

The documentation for this class was generated from the following file:
  • /github/workspace/code/foundation/ids/idpool.h