Class hierarchy   Compound list   File list   Compound Members   File Members  

Hashtable Class Reference

A hashtable is a set of elements (unique elements) Each element is identified by its hash value (see Containable) Note: In non-destructive hashtables, elements must not be deleted before they are removed from the table. More...

Inherits Container.

List of all members.

Public Members


Detailed Description

A hashtable is a set of elements (unique elements) Each element is identified by its hash value (see Containable) Note: In non-destructive hashtables, elements must not be deleted before they are removed from the table.

All methods that accept "Data" ( except put() ) do not require the actual item (this would be rediculous) but a containable that has the same hash value as the required item.


Member Function Documentation

Hashtable::Hashtable(unsigned Flags=0)

Construct an empty hash table.

Hashtable::Hashtable(Hashtable& H)

Construct a copy of a hash table.

Hashtable::~Hashtable()

Destructor.

Hashtable& Hashtable::operator=(Hashtable& H)

Copy a hash table.

DS_BOOL Hashtable::contains(Data Item)

Returns non-zero if the item is in the hash table.

Enumeration Hashtable::elements()

Returns an enumeration of the hash table's elements.

DS_BOOL Hashtable::isEmpty()

Returns non-zero if there is no data in the hash table.

void Hashtable::put(Data Item)

Insert a data item to the hash table.

If an item with the same key exists, the new one will overwrite the old one.

int Hashtable::size() const

Returns the number of elements in the hash table.

Reimplemented from Container.

Data Hashtable::get(Data Item)

Retrieve a data item from the hash table.

The parameter must have the same key and return true when tested for equality. For example, a Serial_Containable instance cannot be retrieved from a hashtable, without its actual pointer, because it only equals another Containable which has in the same memory address exactly.

void Hashtable::clear()

Remove all elements from the hash table.

void Hashtable::remove(Data Item)

Remove an item.

Item must conform to Hashtable::get() rules.

void Hashtable::removeElement(int i)

Remove an element by internal order number.


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