Teuchos::HashSet< Key > Class Template Reference

Templated hashtable-based set. More...

#include <Teuchos_HashSet.hpp>

Collaboration diagram for Teuchos::HashSet< Key >:

[legend]
List of all members.

Public Member Functions

 HashSet (int capacity=101)
 Create an empty HashSet.
bool containsKey (const Key &key) const
 Check for the presence of a key.
void put (const Key &key)
 Put a new object into the table.
void remove (const Key &key)
 Remove from the table the element given by key.
int size () const
 Get the number of elements in the table.
Array< Key > arrayify () const
 Get list of keys in Array form.
string toString () const
 Write to a string.

Private Member Functions

void rehash ()
 rebuild the hashtable when the size has changed
int nextPrime (int newCap) const
 get the next prime number near a given capacity

Private Attributes

Array< Array< Key > > data_
int count_
int capacity_
Key mostRecentKey_

Related Functions

(Note that these are not member functions.)

ostream & operator<< (ostream &os, const HashSet< Key > &h)
 Write HashSet to a stream.

Detailed Description

template<class Key>
class Teuchos::HashSet< Key >

Templated hashtable-based set.

HashSet is a hashtable-based set, similar to the STL set class or the Java HashSet class.

Definition at line 51 of file Teuchos_HashSet.hpp.


Constructor & Destructor Documentation

template<class Key>
Teuchos::HashSet< Key >::HashSet int  capacity = 101  )  [inline]
 

Create an empty HashSet.

Definition at line 100 of file Teuchos_HashSet.hpp.


Member Function Documentation

template<class Key>
bool Teuchos::HashSet< Key >::containsKey const Key &  key  )  const [inline]
 

Check for the presence of a key.

Definition at line 107 of file Teuchos_HashSet.hpp.

template<class Key>
void Teuchos::HashSet< Key >::put const Key &  key  )  [inline]
 

Put a new object into the table.

Definition at line 124 of file Teuchos_HashSet.hpp.

template<class Key>
void Teuchos::HashSet< Key >::remove const Key &  key  )  [inline]
 

Remove from the table the element given by key.

Definition at line 212 of file Teuchos_HashSet.hpp.

template<class Key>
int Teuchos::HashSet< Key >::size  )  const [inline]
 

Get the number of elements in the table.

Definition at line 68 of file Teuchos_HashSet.hpp.

template<class Key>
Array< Key > Teuchos::HashSet< Key >::arrayify  )  const [inline]
 

Get list of keys in Array form.

Definition at line 174 of file Teuchos_HashSet.hpp.

template<class Key>
string Teuchos::HashSet< Key >::toString  )  const [inline]
 

Write to a string.

Definition at line 191 of file Teuchos_HashSet.hpp.

template<class Key>
void Teuchos::HashSet< Key >::rehash  )  [inline, private]
 

rebuild the hashtable when the size has changed

Definition at line 157 of file Teuchos_HashSet.hpp.

template<class Key>
int Teuchos::HashSet< Key >::nextPrime int  newCap  )  const [inline, private]
 

get the next prime number near a given capacity


Friends And Related Function Documentation

template<class Key>
ostream & operator<< ostream &  os,
const HashSet< Key > &  h
[related]
 

Write HashSet to a stream.

Definition at line 238 of file Teuchos_HashSet.hpp.


Member Data Documentation

template<class Key>
Array<Array<Key> > Teuchos::HashSet< Key >::data_ [private]
 

Definition at line 82 of file Teuchos_HashSet.hpp.

template<class Key>
int Teuchos::HashSet< Key >::count_ [private]
 

Definition at line 83 of file Teuchos_HashSet.hpp.

template<class Key>
int Teuchos::HashSet< Key >::capacity_ [private]
 

Definition at line 84 of file Teuchos_HashSet.hpp.

template<class Key>
Key Teuchos::HashSet< Key >::mostRecentKey_ [mutable, private]
 

Definition at line 85 of file Teuchos_HashSet.hpp.


The documentation for this class was generated from the following file:
Generated on Thu Sep 18 12:42:53 2008 for Teuchos - Trilinos Tools Package by doxygen 1.3.9.1