Main Page   Class Hierarchy   Compound List   File List   Compound Members  

TValHashSetT< K, U > Class Template Reference

Template class that maintains a collection of keys (K) which are stored according to the hash utility class U. More...

#include <TValHashSetT.hh>

List of all members.

Public Methods

 TValHashSetT ()
 Constructs an empty hash set.

 TValHashSetT (const TValHashSetT< K, U > &set)
 Copy constructor.

 ~TValHashSetT ()
 Destructor.

void Apply (void(*fn)(const K *, void *), void *d)
 Applies the user defined function to every key in self.

void Clear ()
 Removes all keys from self.

bool Contains (const K &k)
 Check if there exists a key in self that compares equal to a.

int Entries ()
 Query number of keys in self.

bool Insert (const K &k)
 Insert a key to the collection.

bool Remove (const K &k)
 Remove a key from the collection.

void Shrink (bool flag)
 Enable or dissable shrinking of bucket array when keys are removed.

TValHashSetT< K, U > & operator= (const TValHashSetT< K, U > &set)
 Assignment operator.


Detailed Description

template<class K, class U>
class TValHashSetT< K, U >

Template class that maintains a collection of keys (K) which are stored according to the hash utility class U.

The class U should contain the static methods Hash and Equal to calculate the hash of K objects and to compare K objects for equality.

See also:
THashInt

THashString

THashT

Author:
Johan Bolmsjo <johan@nocrew.org>


Member Function Documentation

template<class K, class U>
void TValHashSetT< K, U >::Apply void(*    fn)(const K *, void *),
void *    d
 

Applies the user defined function to every key in self.

Parameters:
fn Function pointer to your function.
d Client data to pass to your function.

template<class K, class U>
bool TValHashSetT< K, U >::Contains const K &    k
 

Check if there exists a key in self that compares equal to a.

Parameters:
k Object to compare with.
Returns:
true, match or false, no match.

template<class K, class U>
int TValHashSetT< K, U >::Entries   [inline]
 

Query number of keys in self.

Returns:
Number of keys.

template<class K, class U>
bool TValHashSetT< K, U >::Insert const K &    k
 

Insert a key to the collection.

Parameters:
k Key to insert.
Returns:
true, key inserted or false, key already exists.

template<class K, class U>
bool TValHashSetT< K, U >::Remove const K &    k
 

Remove a key from the collection.

Parameters:
k Key to remove.
Returns:
true, key removed or false, no such key.

template<class K, class U>
void TValHashSetT< K, U >::Shrink bool    flag [inline]
 

Enable or dissable shrinking of bucket array when keys are removed.

This saves memory but costs some CPU time. It is enabled by default.

Parameters:
flag true, enable or false, disable.


The documentation for this class was generated from the following file:
Generated on Sat Feb 15 18:37:16 2003 for Tools by doxygen1.3-rc2