#include <hashtable.h>
Public Member Functions | |
| HashTable (size_t _initialSize=25) | |
| The constructor. | |
| bool | insert (Key const &_key, Data const &_data) |
| Inserts data into the table. | |
| bool | find (Key const &_key, Data &_data) const |
| Finds a node in the table and copies the data from that node to a specified location. | |
| Data | find (Key const &_key) const |
| Finds a node in the table and returns the data at that node. | |
| bool | erase (Key const &_key) |
| Deletes a node from the table, specified by the node's key. | |
| bool | exists (Key const &_key) const |
| Tests whether a key is in the table or not. | |
| size_t | size () const |
| Indicates the number of subtrees. | |
| size_t | used () const |
| Indicates the number of items in the table. | |
| size_t | mem_usage () const |
| Returns the overhead caused by the data structure. | |
Private Member Functions | |
| HashTable (const HashTable< Key, Data > &) | |
| Private copy constructor. | |
| HashTable< Key, Data > & | operator= (const HashTable< Key, Data > &) |
| Private assignment operator. | |
Private copy constructor.
Not yet written, so declared private for now to prevent an auto-generated one from performing an unexpected operation.
| HashTable | ( | size_t | _initialSize = 25 |
) |
The constructor.
| _initialSize | The initial size of the hash table. Minimum is 500. |
| bool erase | ( | Key const & | _key | ) |
Deletes a node from the table, specified by the node's key.
| _key | The key of the node to delete. |
| bool exists | ( | Key const & | _key | ) | const |
Tests whether a key is in the table or not.
| _key | The key of the node to find. |
| Data find | ( | Key const & | _key | ) | const |
Finds a node in the table and returns the data at that node.
| _key | The key of the item to find. |
| bool find | ( | Key const & | _key, | |
| Data & | _data | |||
| ) | const |
Finds a node in the table and copies the data from that node to a specified location.
| _key | The key of the node to find. | |
| _data | On return, will contain the data at the node. If not found, _data does not change. |
| bool insert | ( | Key const & | _key, | |
| Data const & | _data | |||
| ) |
Inserts data into the table.
| _key | The key of the data. | |
| _data | The data to insert. |
| size_t mem_usage | ( | ) | const |
Returns the overhead caused by the data structure.
Private assignment operator.
Not yet written, so declared private for now to prevent an auto-generated one from performing an unexpected operation.
| size_t size | ( | ) | const [inline] |
Indicates the number of subtrees.
| size_t used | ( | ) | const [inline] |
Indicates the number of items in the table.
1.5.8