Safe identifier handle used as an alternative to raw actor pointers. More...
#include <UniqueID.h>
Public Member Functions | |
| UniqueID () | |
| Constructs an invalid UniqueID. | |
| UniqueID (u32 id) | |
| Constructs an UniqueID from a raw 32-bit packed value containing both the array index and create index. | |
| UniqueID (u32 i_array_index, u32 i_create_index) | |
| Constructs an UniqueID by packing a physical index and a global generation index. | |
| void | setValue (u32 id) |
| Overwrites the ID with a raw 32-bit packed value containing both the array index and create index. | |
| void | setValue (u32 i_array_index, u32 i_create_index) |
| Overwrites the ID by packing a physical index and a global generation index. | |
| u32 | getValue () const |
| The raw 32-bit packed value of this ID. | |
| u32 | getArrayIndex () const |
| Extracts the physical array index where this actor is stored. | |
| u32 | getCreateIndex () const |
| Extracts the global generation counter assigned to this actor at creation. | |
| bool | isValid () const |
Whether this ID has been assigned a valid value (not equal to cInvalidID). | |
| void | invalidate () |
Clears the ID, setting it back to cInvalidID. | |
Static Public Attributes | |
| static const u32 | cInvalidID = 0 |
| Represents an invalid or uninitialized ID. | |
| static const u32 | cArrayIndexMax = 0x3FF |
| The maximum allowed array index (10 bits; 1023). | |
| static const u32 | cCreateIndexMax = 0x3FFFFF |
| The maximum allowed global create index (22 bits; 4,194,303) | |
Private Attributes | |
| u32 | mValue |
| The raw 32-bit packed value containing both the array index and create index. | |
Friends | |
| bool | operator== (const UniqueID &lhs, const UniqueID &rhs) |
| Compares two UniqueIDs for equality. | |
| bool | operator!= (const UniqueID &lhs, const UniqueID &rhs) |
| Compares two UniqueIDs for inequality. | |
Safe identifier handle used as an alternative to raw actor pointers.
Combines a physical ActorPtrCache array index with a global generation counter. This ensures that recycled array slots are never misidentified as the original actor.
|
inline |
Constructs an invalid UniqueID.
|
inlineexplicit |
Constructs an UniqueID from a raw 32-bit packed value containing both the array index and create index.
| id | The raw 32-bit representation of the desired ID to create. |
|
inline |
Constructs an UniqueID by packing a physical index and a global generation index.
| i_array_index | The 10-bit physical index in the ActorPtrCache array. |
| i_create_index | The 22-bit global generation counter. |
|
inline |
Overwrites the ID with a raw 32-bit packed value containing both the array index and create index.
| id | The raw 32-bit representation of the desired ID to set. |
|
inline |
Overwrites the ID by packing a physical index and a global generation index.
| i_array_index | The 10-bit physical index in the ActorPtrCache array. Must be <= cArrayIndexMax. |
| i_create_index | The 22-bit global generation counter. Must be <= cCreateIndexMax. |
|
inline |
The raw 32-bit packed value of this ID.
|
inline |
Extracts the physical array index where this actor is stored.
|
inline |
Extracts the global generation counter assigned to this actor at creation.
|
inline |
Whether this ID has been assigned a valid value (not equal to cInvalidID).
|
inline |
Clears the ID, setting it back to cInvalidID.
Compares two UniqueIDs for equality.
Compares two UniqueIDs for inequality.
|
static |
Represents an invalid or uninitialized ID.
|
static |
The maximum allowed array index (10 bits; 1023).
|
static |
The maximum allowed global create index (22 bits; 4,194,303)
|
private |
The raw 32-bit packed value containing both the array index and create index.