![]() |
ezEngine Release 25.08
|
An associative container. Similar to STL::map. More...
#include <Map.h>
Inherited by ezMap< ezUInt64, HashedData, ezCompareHelper< ezUInt64 >, ezStaticsAllocatorWrapper >, ezMap< ezGeometry::Vertex, ezUInt32 >, ezMap< ezUuid, ezAbstractObjectNode * >, ezMap< ezStringView, ezAbstractObjectNode * >, ezMap< ezHybridString, CategoryData >, ezMap< ezHybridString, ezHybridString >, ezMap< ezUuid, ezTreeNode< ezActionMapDescriptor > * >, ezMap< ezHybridString, ezActionMap * >, ezMap< const ezRTTI *, ezActorPlugin * >, ezMap< SectorID, ezAiNavMeshSector >, ezMap< ezHybridString, ezAiNavMesh * >, ezMap< ezHybridString, dtQueryFilter >, ezMap< const ezAnimGraphNode *, ConnectionsTo >, ezMap< const ezSkeletonResource *, CachedAnim >, ezMap< ezHybridString, ezHybridArray< ezUuid, 1 > >, ezMap< ezHybridString, ezUniquePtr< ezAssetDocumentInfo > >, ezMap< ezHybridString, ezFileStatus >, ezMap< ezHybridString, ezSet< ezHybridString > >, ezMap< ezHybridString, ezAssetTable::ManagerResource >, ezMap< const ezPlatformProfile *, ezUniquePtr< ezAssetTable > >, ezMap< ezHybridString, FileCheckCache >, ezMap< ezHybridString, CustomAction >, ezMap< ezHybridString, const ezDocumentTypeDescriptor * >, ezMap< const ezPin *, ezHybridArray< const ezConnection *, 6 > >, ezMap< ezUInt64, ezHybridString >, ezMap< ezHybridString, ezDynamicBitflags >, ezMap< ezInt32, ezHybridString >, ezMap< ezHybridString, ezDynamicEnum >, ezMap< ezDynamicTree::ezMultiMapKey, ezDynamicTree::ezObjectData >, ezMap< ezHybridString, ezDynamicStringEnum >, ezMap< HandleType, ezUuid >, ezMap< ezUuid, ezEditorEngineSyncObject * >, ezMap< ezUuid, ezHybridArray< GoReferenceTo, 4 > >, ezMap< ezUuid, ezHybridArray< GoReferencedBy, 4 > >, ezMap< ezUuid, ParamData >, ezMap< ezHybridString, ezFileSystemMirror::DirEntry >, ezMap< ezHybridString, T >, ezMap< ezHybridString, ezUInt16 >, ezMap< ezHybridString, FileCacheStatus >, ezMap< ezUInt32, ezDelegate >, ezMap< ezHybridString, float >, ezMap< ezHybridString, ezFmodConfiguration >, ezMap< ezUInt32, ezDynamicArray< TempResource >, ezCompareHelper< ezUInt32 >, ezLocalAllocatorWrapper >, ezMap< ezUInt32, Allocation >, ezMap< ezUInt32, ezDynamicArray< ezGPUResourcePool::TextureHandleWithAge > >, ezMap< ezUInt32, ezDynamicArray< ezGPUResourcePool::BufferHandleWithAge > >, ezMap< const ezRTTI *, ezGameObjectEditTool * >, ezMap< ezString, ezActionMap >, ezMap< ezString, ezInputSlot >, ezMap< ezTime, Data >, ezMap< ezJoltRopeComponent *, ezInt32 >, ezMap< ezJoltRagdollComponent *, ezInt32 >, ezMap< ezJoltBreakableSlabComponent *, ezInt32 >, ezMap< ezUInt64, ezJoltContactListener::TriggerObj >, ezMap< DebugBodyShapeKey, DebugGeo >, ezMap< const void *, DebugGeoShape >, ezMap< const ezDocument *, Data >, ezMap< ezHybridString, ezVariant >, ezMap< ezTypedResourceHandle< class ezShaderResource >, ezUniquePtr< MaterialShaderConstants > >, ezMap< const void *, ezMaterialManager::MaterialData >, ezMap< ezHybridString, ezModelImporter2::OutputTexture >, ezMap< ezUInt32, ezHybridArray< MeshInstance, 4 > >, ezMap< TextureSemantic, ezHybridString >, ezMap< PropertySemantic, ezVariant >, ezMap< ezHybridString, ezTransformTemplate >, ezMap< ezHybridString, ezOBJLoader::Material >, ezMap< const ezDocumentObject *, ezHybridArray >, ezMap< ezHybridString, ezOpenDdlReaderElement * >, ezMap< ezHybridString, ezColor >, ezMap< ezHybridString, ezParticleEffectHandle >, ezMap< ezHybridString, ezParticleStreamFactory * >, ezMap< ezHashedString, ezHashSet< ezHashedString > >, ezMap< vk::Image, ImageState >, ezMap< vk::Buffer, BufferState >, ezMap< ezHybridString, ezPluginBundle, ezCompareString_NoCase >, ezMap< ezUInt64, ezUniquePtr< ezAbstractObjectGraph > >, ezMap< ezUuid, ezUniquePtr< PrefabData > >, ezMap< const ezDocument *, ezMap< const ezRTTI *, ezPreferences * > >, ezMap< ezHybridString, MacroDefinition >, ezMap< ezHybridString, ezPropertyUiState >, ezMap< ezUuid, Binding >, ezMap< ezHybridString, ezCVarWidgetData >, ezMap< ezHybridString, TransferData >, ezMap< ezHybridString, TransferDataObject >, ezMap< ezInt64, QCheckBox * >, ezMap< ezHybridString, ezUInt32 >, ezMap< ezHybridString, GlobalEventsData >, ezMap< QString, CacheEntry >, ezMap< QString, QPixmap >, ezMap< ezHybridString, ImageGeneratorFunc >, ezMap< ezHybridString, QTreeWidgetItem * >, ezMap< ezHybridString, SlotData >, ezMap< ezHybridString, ActionData >, ezMap< ezHybridString, ezDelegate >, ezMap< ezHybridString, StatData >, ezMap< ezUInt32, AllocatorData >, ezMap< const ezDocumentObject *, ezQtNode * >, ezMap< const ezDocumentObject *, ezQtConnection * >, ezMap< ezHybridString, ezDocumentObject * >, ezMap< ezHybridString, PluginsData >, ezMap< ezUuid, const ezDocument * >, ezMap< ezUInt32, bool >, ezMap< ezActionDescriptorHandle, QWeakPointer< ezQtProxy > >, ezMap< const ezDocument *, ezMap< ezActionDescriptorHandle, QWeakPointer< ezQtProxy > > >, ezMap< QWidget *, ezMap< ezActionDescriptorHandle, QWeakPointer< ezQtProxy > > >, ezMap< ezHybridString, TypeData >, ezMap< ezUuid, ezQtGameObjectWidget * >, ezMap< ezHybridString, QStandardItem * >, ezMap< ezHybridString, StatsData >, ezMap< ezHybridString, SubsystemData >, ezMap< ezHybridString, ClockData >, ezMap< QModelIndex, bool >, ezMap< ezHybridString, PropertyWidgetData >, ezMap< ezHybridString, QIcon >, ezMap< ezHybridString, QImage >, ezMap< ezHybridString, QPixmap >, ezMap< ezHybridString, ezSharedPtr< ezRasterizerObject > >, ezMap< const ezRTTI *, ReflectedTypeStorageMapping * >, ezMap< ShaderVertexDecl, ezGALVertexDeclarationHandle >, ezMap< ezUInt32, ezDynamicArray< ezConstantBufferStorageBase * > >, ezMap< const ezRenderPipelinePass *, ConnectionData >, ezMap< ezHybridString, ezRenderWorld::CameraConfig >, ezMap< const ezRTTI *, ezResourcePriority >, ezMap< const ezRTTI *, ezResourceTypeLoader * >, ezMap< ezResource *, ezUniquePtr< ezResourceTypeLoader > >, ezMap< const ezRTTI *, ezHybridArray< ezResourceManager::DerivedTypeInfo, 4 > >, ezMap< ezHybridString, const ezRTTI * >, ezMap< const ezRTTI *, ezResourceManager::ResourceTypeInfo >, ezMap< ezHybridString, ezHybridArray< ezHybridString, 4 > >, ezMap< const char *, ezGALVertexAttributeSemantic::Enum, CompareConstChar >, ezMap< ezUInt32, ezShaderStageBinary >, ezMap< ezHybridString, ShaderData >, ezMap< size_t, ezSingletonRegistry::SingletonEntry >, ezMap< ezUuid, SoundBankCache >, ezMap< ezHybridString, FileContent >, ezMap< ezHybridString< 64 >, ezUInt32 >, ezMap< ezTempHashedString, ezTag >, ezMap< ezUInt64, MessageQueue >, ezMap< ezHybridString, ezTokenizedFileCache::FileData >, ezMap< ezHybridString, ezToolsTag >, ezMap< const ezGALBufferVulkan *, vk::DescriptorBufferInfo >, ezMap< ezHybridString, PropertyValue >, ezMap< const ezDocumentObject *, NodeState >, ezMap< const ezPin *, OutputPinState >, ezMap< ezInt8, ezSet< ezHybridString > >, ezMap< const ezRTTI *, ezVisualShaderNodeDescriptor >, ezMap< const ezDocument *, DocData >, ezMap< ezGameObjectHandle, ezUuid >, ezMap< ezComponentHandle, ezUuid >, ezMap< ezUInt32, ezUuid >, ezMap< ezGameObjectHandle, ezUInt32 >, ezMap< ezComponentHandle, ezUInt32 >, and ezMap< KeyType, ValueType, Comparer, AllocatorWrapper >.
Public Types | |
using | ConstIterator = ezMapBaseConstIteratorBase< KeyType, ValueType, Comparer, false > |
using | ConstReverseIterator = ezMapBaseConstIteratorBase< KeyType, ValueType, Comparer, true > |
using | Iterator = ezMapBaseIteratorBase< KeyType, ValueType, Comparer, false > |
using | ReverseIterator = ezMapBaseIteratorBase< KeyType, ValueType, Comparer, true > |
Public Member Functions | |
bool | IsEmpty () const |
Returns whether there are no elements in the map. O(1) operation. | |
ezUInt32 | GetCount () const |
Returns the number of elements currently stored in the map. O(1) operation. | |
void | Clear () |
Destroys all elements in the map and resets its size to zero. | |
Iterator | GetIterator () |
Returns an Iterator to the very first element. | |
ReverseIterator | GetReverseIterator () |
Returns a ReverseIterator to the very last element. | |
ConstIterator | GetIterator () const |
Returns a constant Iterator to the very first element. | |
ConstReverseIterator | GetReverseIterator () const |
Returns a constant ReverseIterator to the very last element. | |
template<typename CompatibleKeyType , typename CompatibleValueType > | |
Iterator | Insert (CompatibleKeyType &&key, CompatibleValueType &&value) |
Inserts the key/value pair into the tree and returns an Iterator to it. O(log n) operation. | |
template<typename CompatibleKeyType > | |
bool | Remove (const CompatibleKeyType &key) |
Erases the key/value pair with the given key, if it exists. O(log n) operation. | |
Iterator | Remove (const Iterator &pos) |
Erases the key/value pair at the given Iterator. O(log n) operation. Returns an iterator to the element after the given iterator. | |
template<typename CompatibleKeyType > | |
Iterator | FindOrAdd (CompatibleKeyType &&key, bool *out_pExisted=nullptr) |
Searches for the given key and returns an iterator to it. If it did not exist yet, it is default-created. bExisted is set to true, if the key was found, false if it needed to be created. | |
template<typename CompatibleKeyType > | |
ValueType & | operator[] (const CompatibleKeyType &key) |
Allows read/write access to the value stored under the given key. If there is no such key, a new element is default-constructed. | |
template<typename CompatibleKeyType > | |
bool | TryGetValue (const CompatibleKeyType &key, ValueType &out_value) const |
Returns whether an entry with the given key was found and if found writes out the corresponding value to out_value. | |
template<typename CompatibleKeyType > | |
bool | TryGetValue (const CompatibleKeyType &key, const ValueType *&out_pValue) const |
Returns whether an entry with the given key was found and if found writes out the pointer to the corresponding value to out_pValue. | |
template<typename CompatibleKeyType > | |
bool | TryGetValue (const CompatibleKeyType &key, ValueType *&out_pValue) const |
Returns whether an entry with the given key was found and if found writes out the pointer to the corresponding value to out_pValue. | |
template<typename CompatibleKeyType > | |
const ValueType * | GetValue (const CompatibleKeyType &key) const |
Returns a pointer to the value of the entry with the given key if found, otherwise returns nullptr. | |
template<typename CompatibleKeyType > | |
ValueType * | GetValue (const CompatibleKeyType &key) |
Returns a pointer to the value of the entry with the given key if found, otherwise returns nullptr. | |
template<typename CompatibleKeyType > | |
const ValueType & | GetValueOrDefault (const CompatibleKeyType &key, const ValueType &defaultValue) const |
Either returns the value of the entry with the given key, if found, or the provided default value. | |
template<typename CompatibleKeyType > | |
Iterator | Find (const CompatibleKeyType &key) |
Searches for key, returns an Iterator to it or an invalid iterator, if no such key is found. O(log n) operation. | |
template<typename CompatibleKeyType > | |
Iterator | LowerBound (const CompatibleKeyType &key) |
Returns an Iterator to the element with a key equal or larger than the given key. Returns an invalid iterator, if there is no such element. | |
template<typename CompatibleKeyType > | |
Iterator | UpperBound (const CompatibleKeyType &key) |
Returns an Iterator to the element with a key that is LARGER than the given key. Returns an invalid iterator, if there is no such element. | |
template<typename CompatibleKeyType > | |
ConstIterator | Find (const CompatibleKeyType &key) const |
Searches for key, returns an Iterator to it or an invalid iterator, if no such key is found. O(log n) operation. | |
template<typename CompatibleKeyType > | |
bool | Contains (const CompatibleKeyType &key) const |
Checks whether the given key is in the container. | |
template<typename CompatibleKeyType > | |
ConstIterator | LowerBound (const CompatibleKeyType &key) const |
Returns an Iterator to the element with a key equal or larger than the given key. Returns an invalid iterator, if there is no such element. | |
template<typename CompatibleKeyType > | |
ConstIterator | UpperBound (const CompatibleKeyType &key) const |
Returns an Iterator to the element with a key that is LARGER than the given key. Returns an invalid iterator, if there is no such element. | |
ezAllocator * | GetAllocator () const |
Returns the allocator that is used by this instance. | |
bool | operator== (const ezMapBase< KeyType, ValueType, Comparer > &rhs) const |
Comparison operator. | |
EZ_ADD_DEFAULT_OPERATOR_NOTEQUAL (const ezMapBase< KeyType, ValueType, Comparer > &) | |
ezUInt64 | GetHeapMemoryUsage () const |
Returns the amount of bytes that are currently allocated on the heap. | |
void | Swap (ezMapBase< KeyType, ValueType, Comparer > &other) |
Swaps this map with the other one. | |
template<typename CompatibleKeyType > | |
EZ_ALWAYS_INLINE bool | TryGetValue (const CompatibleKeyType &key, ValueType &out_value) const |
template<typename CompatibleKeyType > | |
EZ_ALWAYS_INLINE bool | TryGetValue (const CompatibleKeyType &key, const ValueType *&out_pValue) const |
template<typename CompatibleKeyType > | |
EZ_ALWAYS_INLINE bool | TryGetValue (const CompatibleKeyType &key, ValueType *&out_pValue) const |
template<typename CompatibleKeyType > | |
EZ_ALWAYS_INLINE const ValueType * | GetValue (const CompatibleKeyType &key) const |
template<typename CompatibleKeyType > | |
EZ_ALWAYS_INLINE ValueType * | GetValue (const CompatibleKeyType &key) |
template<typename CompatibleKeyType > | |
EZ_ALWAYS_INLINE const ValueType & | GetValueOrDefault (const CompatibleKeyType &key, const ValueType &defaultValue) const |
template<typename CompatibleKeyType > | |
EZ_ALWAYS_INLINE ezMapBase< KeyType, ValueType, Comparer >::Iterator | Find (const CompatibleKeyType &key) |
template<typename CompatibleKeyType > | |
EZ_ALWAYS_INLINE ezMapBase< KeyType, ValueType, Comparer >::ConstIterator | Find (const CompatibleKeyType &key) const |
template<typename CompatibleKeyType > | |
EZ_ALWAYS_INLINE bool | Contains (const CompatibleKeyType &key) const |
template<typename CompatibleKeyType > | |
EZ_ALWAYS_INLINE ezMapBase< KeyType, ValueType, Comparer >::Iterator | LowerBound (const CompatibleKeyType &key) |
template<typename CompatibleKeyType > | |
EZ_ALWAYS_INLINE ezMapBase< KeyType, ValueType, Comparer >::ConstIterator | LowerBound (const CompatibleKeyType &key) const |
template<typename CompatibleKeyType > | |
EZ_ALWAYS_INLINE ezMapBase< KeyType, ValueType, Comparer >::Iterator | UpperBound (const CompatibleKeyType &key) |
template<typename CompatibleKeyType > | |
EZ_ALWAYS_INLINE ezMapBase< KeyType, ValueType, Comparer >::ConstIterator | UpperBound (const CompatibleKeyType &key) const |
Protected Member Functions | |
ezMapBase (const Comparer &comparer, ezAllocator *pAllocator) | |
Initializes the map to be empty. | |
ezMapBase (const ezMapBase< KeyType, ValueType, Comparer > &cc, ezAllocator *pAllocator) | |
Copies all key/value pairs from the given map into this one. | |
~ezMapBase () | |
Destroys all elements from the map. | |
void | operator= (const ezMapBase< KeyType, ValueType, Comparer > &rhs) |
Copies all key/value pairs from the given map into this one. | |
An associative container. Similar to STL::map.
A map allows to store key/value pairs. This in turn allows to search for values by looking them up with a certain key. Key/Value pairs can also be erased again. All insertion/erasure/lookup functions take O(log n) time. The map is implemented using a balanced tree (a red-black tree), which means the order of insertions/erasures is not important, since it can never create a degenerated tree, and performance will always stay the same.
KeyType is the key type. For example a string.
ValueType is the value type. For example int.
Comparer is a helper class that implements a strictly weak-ordering comparison for Key types.