Isle
Loading...
Searching...
No Matches
MxAtom Class Reference

[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...
 
MxStringGetKey ()
 [AI] Gets the atom key (the string stored in this atom). More...
 

Detailed Description

[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.

Definition at line 33 of file mxatom.h.

Constructor & Destructor Documentation

◆ MxAtom()

MxAtom::MxAtom ( const char *  p_str)
inline

[AI] Constructs an MxAtom with the given string as the key.

Parameters
p_str[AI] String to be used as the unique key for this atom.

Definition at line 41 of file mxatom.h.

Member Function Documentation

◆ Dec()

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.

◆ GetKey()

MxString & MxAtom::GetKey ( )
inline

[AI] Gets the atom key (the string stored in this atom).

Returns
MxString& Reference to the internal string key. [AI]

Definition at line 64 of file mxatom.h.

◆ Inc()

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.


The documentation for this class was generated from the following files: