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

[AI] Atomized (unique) string identifier, managed by reference counting. More...

#include <mxatom.h>

Public Member Functions

 MxAtomId (const char *, LookupMode)
 [AI] Constructs an atom ID for the given string and lookup mode, increments atom reference count. More...
 
 ~MxAtomId ()
 [AI] Destructor for atom ID. More...
 
MxAtomIdoperator= (const MxAtomId &p_atomId)
 [AI] Copy assignment operator. More...
 
MxBool operator== (const MxAtomId &p_atomId) const
 [AI] Tests for equality with another atom ID based on the internal string pointer. More...
 
MxBool operator== (const char *p_internal) const
 [AI] Tests equality against a raw string, using a direct string comparison. More...
 
 MxAtomId ()
 [AI] Constructs a null/empty atom ID. More...
 
void Clear ()
 [AI] Disassociates the atom ID from any atom (decrements reference count, sets internal pointer to NULL). More...
 
const char * GetInternal () const
 [AI] Returns a pointer to the internal string, or nullptr if not set. More...
 

Detailed Description

[AI] Atomized (unique) string identifier, managed by reference counting.

MxAtomId refers to a unique key in the global atom set, and increments/decrements the reference count on construction/destruction and assignment. It abstracts away pointer- or string-based identifier usage, guarantees uniqueness and lifetime management, and can be compared for equality.

[AI] Used throughout the engine to efficiently manage string IDs for resources, scripts, events, and more. The internal value (m_internal) is a const char* to the internal string, guaranteed to remain valid as long as at least one MxAtomId refers to it.

Definition at line 124 of file mxatom.h.

Constructor & Destructor Documentation

◆ MxAtomId() [1/2]

MxAtomId::MxAtomId ( const char *  p_str,
LookupMode  p_mode 
)

[AI] Constructs an atom ID for the given string and lookup mode, increments atom reference count.

Parameters
[in]char*The string value to atomize.
[in]LookupModeLookup mode (case normalization, etc.).

Definition at line 15 of file mxatom.cpp.

◆ ~MxAtomId()

MxAtomId::~MxAtomId ( )

[AI] Destructor for atom ID.

Decrements the reference count for the referenced atom.

Definition at line 32 of file mxatom.cpp.

◆ MxAtomId() [2/2]

MxAtomId::MxAtomId ( )
inline

[AI] Constructs a null/empty atom ID.

[AI] Initializes the atom id to not refer to any atomized string.

Definition at line 182 of file mxatom.h.

Member Function Documentation

◆ Clear()

void MxAtomId::Clear ( )

[AI] Disassociates the atom ID from any atom (decrements reference count, sets internal pointer to NULL).

Definition at line 122 of file mxatom.cpp.

◆ GetInternal()

const char * MxAtomId::GetInternal ( ) const
inline

[AI] Returns a pointer to the internal string, or nullptr if not set.

Returns
const char* Internal string pointer. [AI]

Definition at line 194 of file mxatom.h.

◆ operator=()

MxAtomId & MxAtomId::operator= ( const MxAtomId p_atomId)

[AI] Copy assignment operator.

Decreases reference to current atom if needed, increases reference for the new atom.

Parameters
p_atomId[AI] The source to assign from.
Returns
MxAtomId& Reference to this atom ID after assignment. [AI]

Definition at line 70 of file mxatom.cpp.

◆ operator==() [1/2]

MxBool MxAtomId::operator== ( const char *  p_internal) const
inline

[AI] Tests equality against a raw string, using a direct string comparison.

Parameters
p_internal[AI] String to compare to the atom's internal string.
Returns
MxBool True if the atom's stored string matches p_internal. [AI]

Definition at line 175 of file mxatom.h.

◆ operator==() [2/2]

MxBool MxAtomId::operator== ( const MxAtomId p_atomId) const
inline

[AI] Tests for equality with another atom ID based on the internal string pointer.

Parameters
p_atomId[AI] Atom ID to compare to.
Returns
MxBool True if atom IDs refer to the same string atom. [AI]

Definition at line 152 of file mxatom.h.


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