|
resonance 1.0.1
|
Mix-in that registers its most derived object in a per-type identifier table. More...
#include <idable.h>


Public Member Functions | |
| IDable (int nId) | |
| Register the object in sObjects under an identifier. | |
| virtual | ~IDable () |
| Release the table slot this object occupies. | |
| Public Member Functions inherited from IDableBase | |
| virtual | ~IDableBase () |
Static Public Attributes | |
| static std::vector< T * > | sObjects |
| Every registered object, indexed by mId. | |
Additional Inherited Members | |
| Protected Attributes inherited from IDableBase | |
| int | mId |
Mix-in that registers its most derived object in a per-type identifier table.
IDable<T> in the RTTI, mangled t6IDable1Z6Player for the one instantiation the image holds. The descriptor at 0x008ef1f0 records IDableBase as its only base at offset 0, so the subobject adds no data of its own and reuses mId at +0x00 with its own vptr at +0x04.
Each instantiation has one table of object pointers. For IDable<Player> the table is the vector at 0x0066f920. The static-initialisation stub at 0x00132618 fills the vector with four null pointers before any player exists.
Three words decide the type. The stub zeroes 0x0066f920, 0x0066f924, and 0x0066f928 in sequence, and 0x0066f924 takes three writes from that stub and no read anywhere else, which is a begin, end, and capacity triple rather than a bare pointer. The destructor indexing the table by loading the first word and adding four times mId is equally consistent with either reading, so it does not settle anything on its own.
Modelling the table as a static member of the template rather than as a file-scope global is an inference from the one-per-instantiation shape. Four Player destructors and eight unrelated readers index the same vector, and a public static member and a global fit both equally well.
|
inlineexplicit |
Register the object in sObjects under an identifier.
Inline. Player's constructor at 0x0012f5c0 expands it, storing the identifier and then, unless it is kIDableUnregistered, the object into the slot the identifier indexes. The slot must already exist, because the vector is not grown.
| nId | The identifier. |
Release the table slot this object occupies.
An object that never registered retains kIDableUnregistered and skips the clear.
|
static |
Every registered object, indexed by mId.
A cleared slot is a null pointer rather than a removed element, and the vector never shrinks. Public because readers outside the hierarchy index it directly, among them Phrase::Load() at 0x001b540c, and the image exposes no accessor.