#include <hashtable.h>
Inheritance diagram for HashTable:
Public Types | |
enum | HASHTABLEDEF { DEFAULTSIZE = 256 } |
Hash table defines. More... | |
Public Member Functions | |
HashTable (int iSize=DEFAULTSIZE) | |
virtual | ~HashTable () |
HashTableType * | Insert (const HashString &rstrKey, HashTableType *pkData) |
HashTableType * | Find (const HashString &rstrKey) |
HashTableType * | Delete (const HashString &rstrKey, HashTableType *pkData=0) |
void | GetAllNodes (std::vector< HashTableNode< HashTableType > * > *pvpkVector) |
void | GetAllNodeData (std::vector< HashTableType * > *pvpkVector) |
void | Clear () |
Protected Member Functions | |
HashTableNodeType * | LookupNode (const HashString &rstrKey, int iIndex=0) |
Protected Attributes | |
HashTableNodeVec * | m_pvkTable |
int | m_iSize |
unsigned int | m_uiElements |
|
Hash table defines.
|
|
Allocate and initialize hash table with the specified number of buckets
|
|
Deallocate memory. This will not deallocate the objects stored in the hash table, to do so you must use GetAllNodeData and deallocate the objects yourself. |
|
Helper method to lookup a node
|
|
Insert key value into hash table. The data will replace any data with the same key previously stored in the table. The old data pointer is returned by this method, it is not deallocated by the hash table.
|
|
Find data for key
|
|
Remove key from hash table. The data for the key is returned by this method, it is not deallocated by the hash table, you must do this manually if needed.
|
|
Get pointers to all hash table nodes. You must not deallocate the nodes, or the hash table will cause unpredictable crashes. Deallocating the data pointers in the nodes is perfectly alright, as long as you do not try to use these pointers later (naturally).
|
|
Get all data pointers stored for all keys in the hash table. You can use this method if you need to deallocate the data objects before deleting the hash table.
|
|
Clear hash table. This will not deallocate any data objects stored in the table, to do this you must use GetAllNodeData() method and deallocate the objects manually. |
|
Hash table |
|
Number of rows in table |
|
Number of objects |