3#include <basis/seadAssert.h>
4#include <basis/seadTypes.h>
7
8
9
10
11
24
25
32
33
34
41
42
43
44
47 setValue(i_array_index, i_create_index);
51
52
53
60
61
62
63
64 void setValue(u32 i_array_index, u32 i_create_index)
66 SEAD_ASSERT(i_array_index <= cArrayIndexMax);
67 SEAD_ASSERT(i_create_index <= cCreateIndexMax);
68 mValue = i_array_index << 22 | i_create_index;
72
73
80
81
82
89
90
91
94 return mValue & cCreateIndexMax;
98
99
102 return mValue != cInvalidID;
106
107
114
115
118 return lhs.mValue == rhs.mValue;
122
123
126 return lhs.mValue != rhs.mValue;
Safe identifier handle used as an alternative to raw actor pointers.
Definition ActorUniqueID.h:13
static const u32 cInvalidID
Represents an invalid or uninitialized ID.
Definition ActorUniqueID.h:16
ActorUniqueID()
Constructs an invalid ActorUniqueID.
Definition ActorUniqueID.h:26
static const u32 cCreateIndexMax
The maximum allowed global create index (22 bits; 4,194,303)
Definition ActorUniqueID.h:20
u32 getValue() const
The raw 32-bit packed value of this ID.
Definition ActorUniqueID.h:74
bool isValid() const
Whether this ID has been assigned a valid value (not equal to cInvalidID).
Definition ActorUniqueID.h:100
u32 getCreateIndex() const
Extracts the global generation counter assigned to this actor at creation.
Definition ActorUniqueID.h:92
u32 getArrayIndex() const
Extracts the physical array index where this actor is stored.
Definition ActorUniqueID.h:83
ActorUniqueID(u32 i_array_index, u32 i_create_index)
Constructs an ActorUniqueID by packing a physical index and a global generation index.
Definition ActorUniqueID.h:45
friend bool operator!=(const ActorUniqueID &lhs, const ActorUniqueID &rhs)
Compares two ActorUniqueIDs for inequality.
Definition ActorUniqueID.h:124
friend bool operator==(const ActorUniqueID &lhs, const ActorUniqueID &rhs)
Compares two ActorUniqueIDs for equality.
Definition ActorUniqueID.h:116
void invalidate()
Clears the ID, setting it back to cInvalidID.
Definition ActorUniqueID.h:108
void setValue(u32 id)
Overwrites the ID with a raw 32-bit packed value containing both the array index and create index.
Definition ActorUniqueID.h:54
void setValue(u32 i_array_index, u32 i_create_index)
Overwrites the ID by packing a physical index and a global generation index.
Definition ActorUniqueID.h:64
ActorUniqueID(u32 id)
Constructs an ActorUniqueID from a raw 32-bit packed value containing both the array index and create...
Definition ActorUniqueID.h:35
static const u32 cArrayIndexMax
The maximum allowed array index (10 bits; 1023).
Definition ActorUniqueID.h:18
u32 mValue
The raw 32-bit packed value containing both the array index and create index.
Definition ActorUniqueID.h:131