#include <NameDictionary.h>
Public Member Functions | |
AZ_CLASS_ALLOCATOR (NameDictionary, AZ::OSAllocator) | |
AZ_TYPE_INFO (NameDictionary, "{6DBF9DEA-1F65-44DB-977C-65BA9047E869}") | |
Name | MakeName (AZStd::string_view name) |
Name | FindName (Name::Hash hash) const |
NameDictionary (AZ::u64 maxHashSlots) | |
void | LoadDeferredNames (Name *deferredHead) |
Static Public Member Functions | |
static void | Create () |
static void | Destroy () |
static bool | IsReady () |
static NameDictionary & | Instance () |
Maintains a list of unique strings for Name objects. The main benefit of the Name system is very fast string equality comparison, because every unique name has a unique ID. The NameDictionary's purpose is to guarantee name IDs do not collide. It also saves memory by removing duplicate strings.
Benchmarks have shown that creating a new Name object can be quite slow when the name doesn't already exist in the NameDictionary, but is comparable to creating an AZStd::string for names that already exist.
|
explicit |
Constructs a NameDictionary with a fixed amount of hash slots
maxHashSlots | exclusive max for the hashValue that be calculated. Can be used to generate more hash collisoins @precondition maxHashSlots value are [1, 2^64-1) |
Name AZ::NameDictionary::FindName | ( | Name::Hash | hash | ) | const |
void AZ::NameDictionary::LoadDeferredNames | ( | Name * | deferredHead | ) |
Loads a list of names, starting at a given list head, and ensures they're all created and linked into our list of deferred load names.
Name AZ::NameDictionary::MakeName | ( | AZStd::string_view | name | ) |
Makes a Name from the provided raw string. If an entry already exists in the dictionary, it is shared. Otherwise, it is added to the internal dictionary.
name | The name to resolve against the dictionary. |