Nebula
Loading...
Searching...
No Matches
Ids Namespace Reference

Detailed Description

This simple Id pool implements a set of free and used consecutive integers.

The pool can be configured to only release new Ids up to a certain maximum, after which it asserts.

Essentially, it allocates a certain amount of new Ids when needed (not following the Array method of doubling its size) and can recycle the indices for later. Unlike the IdGenerationPool, this one does not keep track of how many times an id has been reused, so use this with caution!

Maximum amount of bits produced by this system is 32.

Classes

class  Id
 This class implements some static helper functions to set high and low 32-bit integers, as well as a function to create a complete id from two of them. More...
 
class  IdAllocator
 An ID allocator associates an id with a slice in an N number of arrays. More...
 
class  IdAllocatorSafe
 
class  IdGenerationPool
 Provides a system for creating array friendly id numbers with reuse and generations. More...
 
class  IdPool
 

Typedefs

typedef uint64_t Id64
 
typedef uint32_t Id32
 
typedef uint32_t Id24
 
typedef uint16_t Id16
 
typedef uint8_t Id8
 

Functions

static constexpr Id24 Index (const Id32 id)
 
static constexpr generation_t Generation (const Id32 id)
 
static Id32 CreateId (const Id24 index, generation_t generation)
 

Variables

static constexpr Id64 InvalidId64 = 0xFFFFFFFFFFFFFFFF
 
static constexpr Id32 InvalidId32 = 0xFFFFFFFF
 
static constexpr Id24 InvalidId24 = 0x00FFFFFF
 
static constexpr Id16 InvalidId16 = 0xFFFF
 
static constexpr Id8 InvalidId8 = 0xFF
 

Typedef Documentation

◆ Id16

typedef uint16_t Ids::Id16

◆ Id24

typedef uint32_t Ids::Id24

◆ Id32

typedef uint32_t Ids::Id32

◆ Id64

typedef uint64_t Ids::Id64

◆ Id8

typedef uint8_t Ids::Id8

Function Documentation

◆ CreateId()

static Id32 Ids::CreateId ( const Id24 index,
generation_t generation )
static

◆ Generation()

static constexpr generation_t Ids::Generation ( const Id32 id)
staticconstexpr

◆ Index()

static constexpr Id24 Ids::Index ( const Id32 id)
staticconstexpr

Variable Documentation

◆ InvalidId16

Id16 Ids::InvalidId16 = 0xFFFF
staticconstexpr

◆ InvalidId24

Id24 Ids::InvalidId24 = 0x00FFFFFF
staticconstexpr

◆ InvalidId32

Id32 Ids::InvalidId32 = 0xFFFFFFFF
staticconstexpr

◆ InvalidId64

Id64 Ids::InvalidId64 = 0xFFFFFFFFFFFFFFFF
staticconstexpr

◆ InvalidId8

Id8 Ids::InvalidId8 = 0xFF
staticconstexpr