template <class Data> class TcUtStringHashTable

Template String Hash Table

Public Classes

class iterator: public TcIterator<Data>
Nested Iterator class
iterator()
Constructor.
iterator(TcUtStringHashTable<Data> &t)
Constructor
iterator(const TcUtStringHashTable<Data>::iterator& right)
Copy consructor.
Data getItem() const
Returns the current item
void first()
Reset the iterator to the first element in the table.
void next()
Forward the iterator one element.
const TcUtString& getKey() const
Return the current key index
bool end() const
Determines if the end of the table has been reached. Depracated. See isDone().
bool isDone() const
Determines if the end of the table has been reached, same as end().
Data currentItem() const
Returns the current item
const TcUtStringHashTable <Data> ::iterator& operator=(const TcUtStringHashTable<Data>::iterator& right)
Assignment operator.

Public Methods

TcUtStringHashTable()
Constructor.
~TcUtStringHashTable()
Destructor.
int insert(const TcUtString &key, Data item)
Insert an item into the table
TcUtStringHashTable <Data> ::iterator first()
Returns an interator to the first item in the table.
TcUtStringHashTable::iterator find(const TcUtString& name)
Returns an iterator to an item with index matching name
void erase(const TcUtString& key)
Remove an index entry from the table.
bool empty()
Returns true if the table is empty and false otherwise.

Documentation

Template String Hash Table
TcUtStringHashTable()
Constructor.

~TcUtStringHashTable()
Destructor.

class iterator: public TcIterator<Data>
Nested Iterator class

iterator()
Constructor.

iterator(TcUtStringHashTable<Data> &t)
Constructor
Parameters:
t - An instance of a TcUtStringHashTable to be traversed.

iterator(const TcUtStringHashTable<Data>::iterator& right)
Copy consructor.

Data getItem() const
Returns the current item. Depracated. See currentItem() It is important to check that the iterator is not at the end before trying to get the current item. Behavior is undefined if this method is called when end() returns true.

void first()
Reset the iterator to the first element in the table.

void next()
Forward the iterator one element.

const TcUtString& getKey() const
Return the current key index. It is important to check that the iterator is not at the end before trying to get the key index. Behavior is undefined if this method is called when end() returns true.

bool end() const
Determines if the end of the table has been reached. Depracated. See isDone().

bool isDone() const
Determines if the end of the table has been reached, same as end().

Data currentItem() const
Returns the current item. It is important to check that the iterator is not at the end before trying to get the current item. Behavior is undefined if this method is called when end() returns true.

const TcUtStringHashTable <Data> ::iterator& operator=(const TcUtStringHashTable<Data>::iterator& right)
Assignment operator.

int insert(const TcUtString &key, Data item)
Insert an item into the table. The implementation is based on SGIs hash map. Returns 1 on successful insertion and 0 on failure.
Parameters:
key - Unique string name for hash index. The key _MUST_ be a reference to dynamically allocated data whose lifespan is equal to that of the table.
item - Data associated with the key.

TcUtStringHashTable <Data> ::iterator first()
Returns an interator to the first item in the table.

TcUtStringHashTable::iterator find(const TcUtString& name)
Returns an iterator to an item with index matching name. If the item is not found the iterator will point to the end of the table and the isDone() method will return true.

void erase(const TcUtString& key)
Remove an index entry from the table.

bool empty()
Returns true if the table is empty and false otherwise.


This class has no child classes.

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de