Safe identifier handle used as an alternative to raw actor pointers.
More...
#include <ActorUniqueID.h>
|
| | ActorUniqueID () |
| | Constructs an invalid ActorUniqueID.
|
| | ActorUniqueID (u32 id) |
| | Constructs an ActorUniqueID from a raw 32-bit packed value containing both the array index and create index.
|
| | ActorUniqueID (u32 i_array_index, u32 i_create_index) |
| | Constructs an ActorUniqueID 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 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)
|
|
| u32 | mValue |
| | The raw 32-bit packed value containing both the array index and create index.
|
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.
◆ ActorUniqueID() [1/3]
| ActorUniqueID::ActorUniqueID |
( |
| ) |
|
|
inline |
◆ ActorUniqueID() [2/3]
| ActorUniqueID::ActorUniqueID |
( |
u32 | id | ) |
|
|
inline |
Constructs an ActorUniqueID from a raw 32-bit packed value containing both the array index and create index.
- Parameters
-
| id | The raw 32-bit representation of the desired ID to create. |
◆ ActorUniqueID() [3/3]
| ActorUniqueID::ActorUniqueID |
( |
u32 | i_array_index, |
|
|
u32 | i_create_index ) |
|
inline |
Constructs an ActorUniqueID by packing a physical index and a global generation index.
- Parameters
-
| i_array_index | The 10-bit physical index in the ActorPtrCache array. |
| i_create_index | The 22-bit global generation counter. |
◆ setValue() [1/2]
| void ActorUniqueID::setValue |
( |
u32 | id | ) |
|
|
inline |
Overwrites the ID with a raw 32-bit packed value containing both the array index and create index.
- Parameters
-
| id | The raw 32-bit representation of the desired ID to set. |
◆ setValue() [2/2]
| void ActorUniqueID::setValue |
( |
u32 | i_array_index, |
|
|
u32 | i_create_index ) |
|
inline |
Overwrites the ID by packing a physical index and a global generation index.
- Parameters
-
| 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. |
◆ getValue()
| u32 ActorUniqueID::getValue |
( |
| ) |
const |
|
inline |
The raw 32-bit packed value of this ID.
◆ getArrayIndex()
| u32 ActorUniqueID::getArrayIndex |
( |
| ) |
const |
|
inline |
Extracts the physical array index where this actor is stored.
- Returns
- The 10-bit array index (top bits of the packed ID).
◆ getCreateIndex()
| u32 ActorUniqueID::getCreateIndex |
( |
| ) |
const |
|
inline |
Extracts the global generation counter assigned to this actor at creation.
- Returns
- The 22-bit create index (bottom bits of the packed ID).
◆ isValid()
| bool ActorUniqueID::isValid |
( |
| ) |
const |
|
inline |
Whether this ID has been assigned a valid value (not equal to cInvalidID).
◆ invalidate()
| void ActorUniqueID::invalidate |
( |
| ) |
|
|
inline |
Clears the ID, setting it back to cInvalidID.
◆ operator==
Compares two ActorUniqueIDs for equality.
◆ operator!=
Compares two ActorUniqueIDs for inequality.
◆ cInvalidID
| const u32 ActorUniqueID::cInvalidID = 0 |
|
static |
Represents an invalid or uninitialized ID.
◆ cArrayIndexMax
| const u32 ActorUniqueID::cArrayIndexMax = 0x3ff |
|
static |
The maximum allowed array index (10 bits; 1023).
◆ cCreateIndexMax
| const u32 ActorUniqueID::cCreateIndexMax = 0x3fffff |
|
static |
The maximum allowed global create index (22 bits; 4,194,303)
◆ mValue
| u32 ActorUniqueID::mValue |
|
private |
The raw 32-bit packed value containing both the array index and create index.