ezEngine  Milestone 7
ezHashTable< KeyType, ValueType, Hasher, AllocatorWrapper > Class Template Reference

#include <HashTable.h>

Inheritance diagram for ezHashTable< KeyType, ValueType, Hasher, AllocatorWrapper >:

Public Member Functions

 ezHashTable (ezAllocatorBase *pAllocator)
 
 ezHashTable (const ezHashTable< KeyType, ValueType, Hasher, AllocatorWrapper > &other)
 
 ezHashTable (const ezHashTableBase< KeyType, ValueType, Hasher > &other)
 
void operator= (const ezHashTable< KeyType, ValueType, Hasher, AllocatorWrapper > &rhs)
 
void operator= (const ezHashTableBase< KeyType, ValueType, Hasher > &rhs)
 
- Public Member Functions inherited from ezHashTableBase< KeyType, ValueType, Hasher >
bool operator== (const ezHashTableBase< KeyType, ValueType, Hasher > &rhs) const
 Compares this table to another table.
 
bool operator!= (const ezHashTableBase< KeyType, ValueType, Hasher > &rhs) const
 Compares this table to another table.
 
void Reserve (ezUInt32 uiCapacity)
 Expands the hashtable by over-allocating the internal storage so that the load factor is lower or equal to 60% when inserting the given number of entries.
 
void Compact ()
 Tries to compact the hashtable to avoid wasting memory. More...
 
ezUInt32 GetCount () const
 Returns the number of active entries in the table.
 
bool IsEmpty () const
 Returns true, if the hashtable does not contain any elements.
 
void Clear ()
 Clears the table.
 
bool Insert (const KeyType &key, const ValueType &value, ValueType *out_oldValue=nullptr)
 Inserts the key value pair or replaces value if an entry with the given key already exists. More...
 
bool Remove (const KeyType &key, ValueType *out_oldValue=nullptr)
 Removes the entry with the given key. Returns if an entry was removed and optionally writes out the old value to out_oldValue.
 
bool TryGetValue (const KeyType &key, ValueType &out_value) const
 Returns if an entry with the given key was found and if found writes out the corresponding value to out_value.
 
bool TryGetValue (const KeyType &key, ValueType *&out_pValue) const
 Returns if an entry with the given key was found and if found writes out the pointer to the corresponding value to out_pValue.
 
ValueType & operator[] (const KeyType &key)
 Returns the value to the given key if found or creates a new entry with the given key and a default constructed value.
 
bool Contains (const KeyType &key) const
 Returns if an entry with given key exists in the table.
 
Iterator GetIterator ()
 Returns an Iterator to the very first element.
 
ConstIterator GetIterator () const
 Returns a constant Iterator to the very first element.
 
ezAllocatorBaseGetAllocator () const
 Returns the allocator that is used by this instance.
 
ezUInt64 GetHeapMemoryUsage () const
 Returns the amount of bytes that are currently allocated on the heap.
 

Additional Inherited Members

- Protected Member Functions inherited from ezHashTableBase< KeyType, ValueType, Hasher >
 ezHashTableBase (ezAllocatorBase *pAllocator)
 Creates an empty hashtable. Does not allocate any data yet.
 
 ezHashTableBase (const ezHashTableBase< KeyType, ValueType, Hasher > &rhs, ezAllocatorBase *pAllocator)
 Creates a copy of the given hashtable.
 
 ~ezHashTableBase ()
 Destructor.
 
void operator= (const ezHashTableBase< KeyType, ValueType, Hasher > &rhs)
 Copies the data from another hashtable into this one.
 

Detailed Description

template<typename KeyType, typename ValueType, typename Hasher = ezHashHelper<KeyType>, typename AllocatorWrapper = ezDefaultAllocatorWrapper>
class ezHashTable< KeyType, ValueType, Hasher, AllocatorWrapper >

See Also
ezHashTableBase

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