| Bullet Collision Detection & Physics Library
    | 
A compact hash table implementation. More...
#include <gim_hash_table.h>

| Public Member Functions | |
| gim_hash_table (GUINT reserve_size=GIM_DEFAULT_HASH_TABLE_SIZE, GUINT node_size=GIM_DEFAULT_HASH_TABLE_NODE_SIZE, GUINT min_hash_table_size=GIM_INVALID_HASH) | |
| ~gim_hash_table () | |
| bool | is_hash_table () | 
| bool | is_sorted () | 
| bool | sort () | 
| bool | switch_to_hashtable () | 
| bool | switch_to_sorted_array () | 
| bool | check_for_switching_to_hashtable () | 
| If the container reaches the.  More... | |
| void | set_sorted (bool value) | 
| GUINT | size () const | 
| Retrieves the amount of keys.  More... | |
| GUINT | get_key (GUINT index) const | 
| Retrieves the hash key.  More... | |
| T * | get_value_by_index (GUINT index) | 
| Retrieves the value by index.  More... | |
| const T & | operator[] (GUINT index) const | 
| T & | operator[] (GUINT index) | 
| GUINT | find (GUINT hashkey) | 
| Finds the index of the element with the key.  More... | |
| T * | get_value (GUINT hashkey) | 
| Retrieves the value associated with the index.  More... | |
| bool | erase_by_index (GUINT index) | 
| bool | erase_by_index_unsorted (GUINT index) | 
| bool | erase_by_key (GUINT hashkey) | 
| void | clear () | 
| GUINT | insert (GUINT hashkey, const T &element) | 
| Insert an element into the hash.  More... | |
| GUINT | insert_override (GUINT hashkey, const T &element) | 
| Insert an element into the hash, and could overrite an existing object with the same hash.  More... | |
| GUINT | insert_unsorted (GUINT hashkey, const T &element) | 
| Insert an element into the hash,But if this container is a sorted array, this inserts it unsorted.  More... | |
| Protected Types | |
| typedef GIM_HASH_TABLE_NODE< T > | _node_type | 
| Protected Member Functions | |
| GUINT | _find_cell (GUINT hashkey) | 
| Returns the cell index.  More... | |
| GUINT | _find_avaliable_cell (GUINT hashkey) | 
| Find the avaliable cell for the hashkey, and return an existing cell if it has the same hash key.  More... | |
| void | _reserve_table_memory (GUINT newtablesize) | 
| reserves the memory for the hash table.  More... | |
| void | _invalidate_keys () | 
| void | _clear_table_memory () | 
| Clear all memory for the hash table.  More... | |
| void | _rehash () | 
| Invalidates the keys (Assigning GIM_INVALID_HASH to all) Reorders the hash keys.  More... | |
| void | _resize_table (GUINT newsize) | 
| Resize hash table indices.  More... | |
| void | _destroy () | 
| Destroy hash table memory.  More... | |
| GUINT | _assign_hash_table_cell (GUINT hashkey) | 
| Finds an avaliable hash table cell, and resizes the table if there isn't space.  More... | |
| bool | _erase_by_index_hash_table (GUINT index) | 
| erase by index in hash table  More... | |
| bool | _erase_hash_table (GUINT hashkey) | 
| erase by key in hash table  More... | |
| GUINT | _insert_hash_table (GUINT hashkey, const T &value) | 
| insert an element in hash table  More... | |
| GUINT | _insert_hash_table_replace (GUINT hashkey, const T &value) | 
| insert an element in hash table.  More... | |
| bool | _erase_sorted (GUINT index) | 
| Sorted array data management. The hash table has the indices to the corresponding m_nodes array.  More... | |
| bool | _erase_unsorted (GUINT index) | 
| faster, but unsorted  More... | |
| void | _insert_in_pos (GUINT hashkey, const T &value, GUINT pos) | 
| Insert in position ordered.  More... | |
| GUINT | _insert_sorted (GUINT hashkey, const T &value) | 
| Insert an element in an ordered array.  More... | |
| GUINT | _insert_sorted_replace (GUINT hashkey, const T &value) | 
| GUINT | _insert_unsorted (GUINT hashkey, const T &value) | 
| Fast insertion in m_nodes array.  More... | |
| Protected Attributes | |
| gim_array< _node_type > | m_nodes | 
| The nodes.  More... | |
| bool | m_sorted | 
| GUINT * | m_hash_table | 
| Hash table data management. The hash table has the indices to the corresponding m_nodes array.  More... | |
| GUINT | m_table_size | 
| GUINT | m_node_size | 
| GUINT | m_min_hash_table_size | 
A compact hash table implementation.
A memory aligned compact hash table that coud be treated as an array. It could be a simple sorted array without the overhead of the hash key bucked, or could be a formely hash table with an array of keys. You can use switch_to_hashtable() and switch_to_sorted_array for saving space or increase speed.
Definition at line 191 of file gim_hash_table.h.
| 
 | protected | 
Definition at line 194 of file gim_hash_table.h.
| 
 | inline | 
if node_size = 0, then this container becomes a simple sorted array allocator. reserve_size is used for reserve memory in m_nodes. When the array size reaches the size equivalent to 'min_hash_table_size', then it becomes a hash table by calling check_for_switching_to_hashtable. If node_size != 0, then this container becomes a hash table for ever
Definition at line 573 of file gim_hash_table.h.
| 
 | inline | 
Definition at line 605 of file gim_hash_table.h.
| 
 | inlineprotected | 
Finds an avaliable hash table cell, and resizes the table if there isn't space.
Definition at line 344 of file gim_hash_table.h.
| 
 | inlineprotected | 
Clear all memory for the hash table.
Definition at line 287 of file gim_hash_table.h.
| 
 | inlineprotected | 
Destroy hash table memory.
Definition at line 337 of file gim_hash_table.h.
| 
 | inlineprotected | 
erase by index in hash table
Definition at line 359 of file gim_hash_table.h.
| 
 | inlineprotected | 
erase by key in hash table
Definition at line 377 of file gim_hash_table.h.
| 
 | inlineprotected | 
Sorted array data management. The hash table has the indices to the corresponding m_nodes array.
Definition at line 454 of file gim_hash_table.h.
| 
 | inlineprotected | 
faster, but unsorted
Definition at line 463 of file gim_hash_table.h.
| 
 | inlineprotected | 
Find the avaliable cell for the hashkey, and return an existing cell if it has the same hash key.
Definition at line 230 of file gim_hash_table.h.
| 
 | inlineprotected | 
Returns the cell index.
Definition at line 211 of file gim_hash_table.h.
| 
 | inlineprotected | 
insert an element in hash table
If the element exists, this won't insert the element
Definition at line 399 of file gim_hash_table.h.
| 
 | inlineprotected | 
insert an element in hash table.
If the element exists, this replaces the element.
Definition at line 426 of file gim_hash_table.h.
| 
 | inlineprotected | 
Insert in position ordered.
Also checks if it is needed to transform this container to a hash table, by calling check_for_switching_to_hashtable
Definition at line 489 of file gim_hash_table.h.
| 
 | inlineprotected | 
Insert an element in an ordered array.
Definition at line 496 of file gim_hash_table.h.
| 
 | inlineprotected | 
Definition at line 527 of file gim_hash_table.h.
| 
 | inlineprotected | 
Fast insertion in m_nodes array.
Definition at line 556 of file gim_hash_table.h.
| 
 | inlineprotected | 
Definition at line 277 of file gim_hash_table.h.
| 
 | inlineprotected | 
Invalidates the keys (Assigning GIM_INVALID_HASH to all) Reorders the hash keys.
Definition at line 296 of file gim_hash_table.h.
| 
 | inlineprotected | 
reserves the memory for the hash table.
Definition at line 263 of file gim_hash_table.h.
| 
 | inlineprotected | 
Resize hash table indices.
Definition at line 326 of file gim_hash_table.h.
| 
 | inline | 
If the container reaches the.
Definition at line 666 of file gim_hash_table.h.
| 
 | inline | 
Definition at line 831 of file gim_hash_table.h.
| 
 | inline | 
Definition at line 767 of file gim_hash_table.h.
| 
 | inline | 
Definition at line 791 of file gim_hash_table.h.
| 
 | inline | 
Definition at line 811 of file gim_hash_table.h.
| 
 | inline | 
Finds the index of the element with the key.
Definition at line 723 of file gim_hash_table.h.
| 
 | inline | 
Retrieves the hash key.
Definition at line 695 of file gim_hash_table.h.
| 
 | inline | 
Retrieves the value associated with the index.
Definition at line 757 of file gim_hash_table.h.
| 
 | inline | 
Retrieves the value by index.
Definition at line 703 of file gim_hash_table.h.
| 
 | inline | 
Insert an element into the hash.
Definition at line 851 of file gim_hash_table.h.
| 
 | inline | 
Insert an element into the hash, and could overrite an existing object with the same hash.
Definition at line 869 of file gim_hash_table.h.
| 
 | inline | 
Insert an element into the hash,But if this container is a sorted array, this inserts it unsorted.
Definition at line 888 of file gim_hash_table.h.
| 
 | inline | 
Definition at line 610 of file gim_hash_table.h.
| 
 | inline | 
Definition at line 616 of file gim_hash_table.h.
| 
 | inline | 
Definition at line 708 of file gim_hash_table.h.
| 
 | inline | 
Definition at line 713 of file gim_hash_table.h.
| 
 | inline | 
Definition at line 683 of file gim_hash_table.h.
| 
 | inline | 
Retrieves the amount of keys.
Definition at line 689 of file gim_hash_table.h.
| 
 | inline | 
Definition at line 622 of file gim_hash_table.h.
| 
 | inline | 
Definition at line 642 of file gim_hash_table.h.
| 
 | inline | 
Definition at line 658 of file gim_hash_table.h.
| 
 | protected | 
Hash table data management. The hash table has the indices to the corresponding m_nodes array.
Definition at line 203 of file gim_hash_table.h.
| 
 | protected | 
Definition at line 206 of file gim_hash_table.h.
| 
 | protected | 
Definition at line 205 of file gim_hash_table.h.
| 
 | protected | 
The nodes.
Definition at line 198 of file gim_hash_table.h.
| 
 | protected | 
Definition at line 200 of file gim_hash_table.h.
| 
 | protected | 
Definition at line 204 of file gim_hash_table.h.
 1.8.12
 1.8.12