ezEngine  Milestone 7
ezArrayMap< KEY, VALUE, AllocatorWrapper > Class Template Reference

See ezArrayMapBase for details. More...

#include <ArrayMap.h>

Inheritance diagram for ezArrayMap< KEY, VALUE, AllocatorWrapper >:

Public Member Functions

 ezArrayMap (ezAllocatorBase *pAllocator)
 
 ezArrayMap (const ezArrayMap< KEY, VALUE, AllocatorWrapper > &rhs)
 
 ezArrayMap (const ezArrayMapBase< KEY, VALUE > &rhs)
 
void operator= (const ezArrayMap< KEY, VALUE, AllocatorWrapper > &rhs)
 
void operator= (const ezArrayMapBase< KEY, VALUE > &rhs)
 
- Public Member Functions inherited from ezArrayMapBase< KEY, VALUE >
 ezArrayMapBase (ezAllocatorBase *pAllocator)
 Constructor.
 
 ezArrayMapBase (const ezArrayMapBase &rhs, ezAllocatorBase *pAllocator)
 Copy-Constructor.
 
void operator= (const ezArrayMapBase &rhs)
 Copy assignment operator.
 
ezUInt32 GetCount () const
 Returns the number of elements stored in the map.
 
bool IsEmpty () const
 True if the map contains no elements.
 
void Clear ()
 Purges all elements from the map.
 
ezUInt32 Insert (const KEY &key, const VALUE &value)
 Always inserts a new value under the given key. Duplicates are allowed. The returned index is only valid briefly, until the map is sorted or modified further.
 
void Sort () const
 Ensures the internal data structure is sorted. This is done automatically every time a lookup needs to be made.
 
ezUInt32 Find (const KEY &key) const
 Returns an index to one element with the given key. If the key is inserted multiple times, there is no guarantee which one is returned. Returns ezInvalidIndex when no such element exists.
 
ezUInt32 LowerBound (const KEY &key) const
 Returns an index to the element with a key equal or larger than the given key. Returns ezInvalidIndex when no such element exists.
 
ezUInt32 UpperBound (const KEY &key) const
 Returns an index to the element with a key that is LARGER than the given key. Returns ezInvalidIndex when no such element exists.
 
const KEY & GetKey (ezUInt32 index) const
 Returns the key that is stored at the given index.
 
const VALUE & GetValue (ezUInt32 index) const
 Returns the value that is stored at the given index.
 
VALUE & GetValue (ezUInt32 index)
 Returns the value that is stored at the given index.
 
VALUE & FindOrAdd (const KEY &key, bool *bExisted=nullptr)
 Returns the value stored at the given key. If none exists, one is created. bExisted indicates whether an element needed to be created.
 
VALUE & operator[] (const KEY &key)
 Same as FindOrAdd.
 
const Pairoperator[] (ezUInt32 index) const
 Returns the key/value pair at the given index.
 
void RemoveAt (ezUInt32 index, bool bKeepSorted=false)
 Removes the element at the given index. More...
 
bool Remove (const KEY &key, bool bKeepSorted=false)
 Removes one element with the given key. Returns true, if one was found and removed. If the same key exists multiple times, you need to call this function multiple times to remove them all. More...
 
bool Contains (const KEY &key) const
 Returns whether an element with the given key exists.
 
void Reserve (ezUInt32 size)
 Reserves enough memory to store size elements.
 
void Compact ()
 Compacts the internal memory to not waste any space.
 
bool operator== (const ezArrayMapBase< KEY, VALUE > &rhs) const
 Compares the two containers for equality.
 
bool operator!= (const ezArrayMapBase< KEY, VALUE > &rhs) const
 Compares the two containers for equality.
 
ezUInt64 GetHeapMemoryUsage () const
 Returns the amount of bytes that are currently allocated on the heap.
 

Private Member Functions

 EZ_DECLARE_MEM_RELOCATABLE_TYPE ()
 

Detailed Description

template<typename KEY, typename VALUE, typename AllocatorWrapper = ezDefaultAllocatorWrapper>
class ezArrayMap< KEY, VALUE, AllocatorWrapper >

See ezArrayMapBase for details.


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