#include <datatypelib.h>
InternedId represents an Id which has been interned into a pool of unique Id objects. I.e., there are no two different Id objects with an equal id string, so for equality comparison you can compare pointers instead of whole strings.
You can use MAXON_INTERNED_ID and MAXON_INTERNED_ID_LOCAL to define interned ids which will be initialized automatically at module initialization.
InternedId uses reference counting, so where possible use {const InternedId&} instead of InternedId to avoid unnecesssary reference counting.
Classes | |
struct | FastCompare |
Public Types | |
using | PrivateInfo = Tuple< UniqueHash > |
Static Public Member Functions | |
template<typename INPUTTYPE > | |
static Result< InternedId > | Create (INPUTTYPE &&inputId) |
static MAXON_ATTRIBUTE_FORCE_INLINE const InternedId & | NullValue () |
static void | PrivateAddReference (const Id *ptr) |
Static Public Attributes | |
static const InternedId | NULL_VALUE |
Private Member Functions | |
void | Release () |
Static Private Member Functions | |
static Bool | IsReferenced (const Id *ptr) |
static void | Free (const Id *ptr) |
Private Attributes | |
const Id * | _id |
Static Private Attributes | |
static constexpr Int | INFO_OFFSET |
Friends | |
class | SystemImpl |
class | ObjectModel |
using PrivateInfo = Tuple<UniqueHash> |
InternedId | ( | ) |
Constructs an empty InternedId. You have to initialize it afterwards using Init().
InternedId | ( | InternedId && | src | ) |
InternedId | ( | const InternedId & | src | ) |
~InternedId | ( | ) |
InternedId& operator= | ( | InternedId && | src | ) |
InternedId& operator= | ( | const InternedId & | src | ) |
|
static |
Creates a new InternedId for the given inputId. All types for which there is an InternedId::Init function are supported.
[in] | inputId | The id to intern. |
INPUTTYPE | The type of inputId. All types for which there is an InternedId::Init function are supported. |
Initializes an InternedId with a given CString.
[in] | str | The string to intern. |
Initializes an InternedId with a given CString.
[in] | str | The string to intern. The string is empty afterwards! |
Initializes an InternedId with a given String.
[in] | str | The string to intern. |
Initializes an InternedId with a given C-style string.
[in] | str | The string to intern. |
[in] | copyString | If true (the default value), a copy of str is made at first (as a RefCountedCString). |
Initializes an InternedId with a given block of characters.
[in] | str | The string to intern, no null termination required. |
operator const Id & | ( | ) | const |
const Id& Get | ( | void | ) | const |
const Id* GetPointer | ( | ) | const |
Returns a pointer to the interned Id. The pointer is unique, i.e., there is no other pointer to an interned Id with an equal string. The Id uses a special reference-counting, so you must only use the returned pointer as long as the owning InternedId is valid.
Bool operator== | ( | const InternedId & | other | ) | const |
Bool operator!= | ( | const InternedId & | other | ) | const |
Bool operator< | ( | const InternedId & | other | ) | const |
MAXON_OPERATOR_INEQUALITY | ( | InternedId | ) |
COMPARERESULT Compare | ( | const InternedId & | other | ) | const |
Compares two InternedId objects using the lexicographic order.
[in] | other | Other InternedId object. |
HashInt GetHashCode | ( | ) | const |
const UniqueHash& GetUniqueHashCode | ( | ) | const |
Returns the 128-bit hash value of this @CLASS. The implementation ensures uniform distribution, so for practical purposes you can safely assume that two objects are equal if their hash values are equal.
const Char* GetCString | ( | ) | const |
Int GetCStringLength | ( | ) | const |
|
static |
String ToString | ( | const FormatStatement * | fmt = nullptr | ) | const |
CString ToCString | ( | ) | const |
Bool IsPopulated | ( | void | ) | const |
Bool IsEmpty | ( | ) | const |
void Reset | ( | void | ) |
|
static |
|
private |
|
staticprivate |
|
friend |
|
friend |
|
static |
|
private |
Pointer to the interned id.
|
staticconstexprprivate |