|
Isle
|
[AI] Generic hash table collection implementing chained (bucketed) hashing, used for efficient lookup and storage of objects by key or value. More...
#include <mxhashtable.h>


Public Types | |
| enum | Option { e_noExpand = 0 , e_expandAll , e_expandMultiply } |
| [AI] Enum describing the strategy for resizing the hash table when load increases. More... | |
Public Member Functions | |
| MxHashTable () | |
| [AI] Default constructor. More... | |
| ~MxHashTable () override | |
| [AI] Destructor. More... | |
| void | Resize () |
| [AI] Expand/recreates the hash table according to the current resizing policy. More... | |
| void | Add (T) |
| [AI] Inserts a new item into the hash table, possibly resizing if automatic resize is enabled and load threshold is exceeded. More... | |
| void | DeleteAll () |
| [AI] Removes and destructs all nodes in all hash buckets, clearing the table. More... | |
| virtual MxU32 | Hash (T) |
| [AI] Computes the hash of the given object. More... | |
Protected Member Functions | |
| void | NodeInsert (MxHashTableNode< T > *) |
| [AI] Inserts a given node into the relevant hash bucket according to the node's hash value. More... | |
Protected Member Functions inherited from MxCollection< T > | |
| MxCollection () | |
| [AI] Constructs an empty collection, initializing count and default element destructor. More... | |
| virtual MxS8 | Compare (T a, T b) |
| [AI] Compares two elements of the collection (default implementation returns zero; override in subclasses for meaningful comparison). More... | |
| ~MxCollection () override | |
| [AI] Virtual destructor for proper polymorphic destruction. More... | |
| void | SetDestroy (void(*p_customDestructor)(T)) |
| [AI] Assigns a custom destructor function to be used for elements of this collection. More... | |
Protected Member Functions inherited from MxCore | |
| MxCore () | |
| [AI] Constructs a new MxCore object and assigns it a unique id. More... | |
| virtual | ~MxCore () |
| [AI] Virtual destructor. Required for correct polymorphic cleanup in derived classes. More... | |
| virtual MxLong | Notify (MxParam &p_param) |
| [AI] Virtual callback notification mechanism. More... | |
| virtual MxResult | Tickle () |
| [AI] Called by tickle managers to allow the object to update itself. More... | |
| virtual const char * | ClassName () const |
| [AI] Returns the runtime class name of this object. More... | |
| virtual MxBool | IsA (const char *p_name) const |
| [AI] Checks whether this object's class type or parents match the given name. More... | |
| MxU32 | GetId () |
| [AI] Gets the unique (per-process) id assigned to this object instance. More... | |
Protected Attributes | |
| MxHashTableNode< T > ** | m_slots |
| [AI] Array of pointers to bucket heads; each slot is a chain of nodes (linked list) holding objects with equal (modulo table size) hashes. More... | |
| MxU32 | m_numSlots |
| [AI] Number of hash buckets in the table; controls how hash values are mapped to buckets. More... | |
| MxU32 | m_autoResizeRatio |
| [AI] Ratio at which the table will auto-resize (load factor denominator). More... | |
| Option | m_resizeOption |
| [AI] Strategy currently in use for resizing the table when needed. More... | |
| union { | |
| MxU32 m_increaseAmount | |
| double m_increaseFactor | |
| }; | |
| [AI] Union holding the setting for table expansion: More... | |
Protected Attributes inherited from MxCollection< T > | |
| MxU32 | m_count |
| [AI] Number of elements currently stored in the collection. More... | |
| void(* | m_customDestructor )(T) |
| [AI] Function pointer to the custom element destructor used for cleanup of elements. More... | |
Friends | |
| class | MxHashTableCursor< T > |
Additional Inherited Members | |
Static Protected Member Functions inherited from MxCollection< T > | |
| static void | Destroy (T obj) |
| [AI] Static no-op destroy function; suitable for types that do not need destruction. More... | |
[AI] Generic hash table collection implementing chained (bucketed) hashing, used for efficient lookup and storage of objects by key or value.
[AI] Inherits collection semantics from MxCollection<T> but also manages resizing, hash calculation, and separate chaining (via MxHashTableNode). Provides insert, deletion, and all-bucket purge operations. Resizing policies can be controlled via Option.
| T | [AI] Type of object managed by the hash table. |
Definition at line 57 of file mxhashtable.h.
| enum MxHashTable::Option |
[AI] Enum describing the strategy for resizing the hash table when load increases.
Definition at line 62 of file mxhashtable.h.
|
inline |
[AI] Default constructor.
Initializes hash table with HASH_TABLE_INIT_SIZE slots and configures resizing behavior.
Definition at line 71 of file mxhashtable.h.
|
override |
[AI] Destructor.
Purges all contained nodes and releases bucket array.
Definition at line 238 of file mxhashtable.h.
|
inline |
[AI] Inserts a new item into the hash table, possibly resizing if automatic resize is enabled and load threshold is exceeded.
| [AI] | p_newobj The item to insert. |
Definition at line 309 of file mxhashtable.h.
| void MxHashTable< T >::DeleteAll |
[AI] Removes and destructs all nodes in all hash buckets, clearing the table.
Definition at line 245 of file mxhashtable.h.
|
inlinevirtual |
[AI] Computes the hash of the given object.
Should be overridden for meaningful hash computation.
| [AI] | (unnamed) The object to compute the hash for. |
Reimplemented in MxVariableTable.
Definition at line 107 of file mxhashtable.h.
|
inlineprotected |
[AI] Inserts a given node into the relevant hash bucket according to the node's hash value.
| p_node | [AI] Node (already allocated) to insert into appropriate bucket. |
Definition at line 294 of file mxhashtable.h.
|
inline |
[AI] Expand/recreates the hash table according to the current resizing policy.
[AI] Moves nodes from the old bucket array to a newly sized one based on m_resizeOption, re-bucketing all nodes.
Definition at line 261 of file mxhashtable.h.
|
friend |
Definition at line 107 of file mxhashtable.h.
| union { ... } MxHashTable< T >::@178 |
[AI] Union holding the setting for table expansion:
|
protected |
[AI] Ratio at which the table will auto-resize (load factor denominator).
Definition at line 125 of file mxhashtable.h.
| MxU32 MxHashTable< T >::m_increaseAmount |
Definition at line 137 of file mxhashtable.h.
| double MxHashTable< T >::m_increaseFactor |
Definition at line 138 of file mxhashtable.h.
|
protected |
[AI] Number of hash buckets in the table; controls how hash values are mapped to buckets.
Definition at line 122 of file mxhashtable.h.
|
protected |
[AI] Strategy currently in use for resizing the table when needed.
Definition at line 128 of file mxhashtable.h.
|
protected |
[AI] Array of pointers to bucket heads; each slot is a chain of nodes (linked list) holding objects with equal (modulo table size) hashes.
Definition at line 119 of file mxhashtable.h.