Isle
|
[AI] Key-value pair representing a unique string (atom) and its reference count. More...
#include <mxatom.h>
Public Member Functions | |
MxAtom (const char *p_str) | |
[AI] Constructs an MxAtom with the given string as the key. More... | |
void | Inc () |
[AI] Increments the usage count for this atom, indicating one more client is using it. More... | |
void | Dec () |
[AI] Decrements the usage count for this atom. More... | |
MxString & | GetKey () |
[AI] Gets the atom key (the string stored in this atom). More... | |
[AI] Key-value pair representing a unique string (atom) and its reference count.
MxAtom is used to atomize strings by acting as a string (the key part) that registers how many times the same atomization key is in use (the value part, which functions as a reference counter). When used via MxAtomId, the reference count is incremented or decremented depending on the MxAtomId's lifecycle. MxAtom objects are managed in a globally accessible set for uniqueness.
[AI] The combination of MxString and a usage count (MxU16) enables memory-efficient reuse of string values that act as IDs or keys and effective cleanup when no longer referenced. The inlined constructor always initializes the usage count to zero.
|
inline |
void MxAtom::Dec | ( | ) |
[AI] Decrements the usage count for this atom.
[AI] When the count reaches zero, this atom may be considered unused and ready for cleanup.
Definition at line 138 of file mxatom.cpp.
|
inline |
void MxAtom::Inc | ( | ) |
[AI] Increments the usage count for this atom, indicating one more client is using it.
[AI] Used by MxAtomId when new IDs referencing this atom are created.
Definition at line 131 of file mxatom.cpp.