OpenFOAM logo
Open Source CFD Toolkit

HashTable Class Template Reference

Inheritance diagram for HashTable:

Inheritance graph
[legend]
Collaboration diagram for HashTable:

Collaboration graph
[legend]
List of all members.

template<class T, class Key = word, class Hash = string::hash>
class Foam::HashTable< T, Key, Hash >


Public Types

typedef Iterator< T &, HashTable<
T, Key, Hash > &, hashedEntry * > 
iterator
typedef Iterator< const T &,
const HashTable< T, Key,
Hash > &, const hashedEntry * > 
const_iterator
typedef T value_type
 Type of values the HashTable contains.
typedef T & reference
 Type that can be used for storing into HashTable::value_type.
typedef const T & const_reference
 Type that can be used for storing into constant.
typedef label size_type
 The type that can represent the size of a HashTable.

Public Member Functions

 HashTable (const label size=100)
 Construct given initial table size.
 HashTable (Istream &, const label size=100)
 Construct from Istream.
 HashTable (const HashTable< T, Key, Hash > &)
 Construct as copy.
 ~HashTable ()
label size () const
 Return number of elements in table.
bool found (const Key &key) const
 Return true if hashedEntry is found in table.
iterator find (const Key &key)
 Find and return an iterator set at the hashedEntry.
const_iterator find (const Key &key) const
 Find and return an const_iterator set at the hashedEntry.
List< Key > toc () const
 Return the table of contents.
bool insert (const Key &key, const T &newElmt)
 Insert a new hashedEntry.
bool erase (const iterator &it)
 Erase an hashedEntry specified by given iterator.
bool erase (const Key &key)
 Erase an hashedEntry specified by given key if in table.
void resize (const label newSize)
 Resize the hash table for efficiency.
void clear ()
 Clear all entries from table.
void transfer (HashTable< T, Key, Hash > &)
 Transfer the contents of the argument table into this table.
T & operator[] (const Key &key)
 Find and return an hashedEntry.
const T & operator[] (const Key &key) const
 Find and return an hashedEntry.
void operator= (const HashTable< T, Key, Hash > &)
 Assignment.
iterator begin ()
 iterator set to the begining of the HashTable
const iteratorend ()
 iterator set to beyond the end of the HashTable
const_iterator begin () const
 const_iterator set to the begining of the HashTable
const const_iteratorend () const
 const_iterator set to beyond the end of the HashTable

Friends

class HashPtrTable
 Declare friendship with the HashPtrTable class.
class Iterator< T&, HashTable<T, Key, Hash>&, hashedEntry* >
class Iterator< const T&, const HashTable<T, Key, Hash>&, const hashedEntry* >
Istreamoperator>> (Istream &, HashTable< T, Key, Hash > &)
Ostreamoperator (Ostream &, const HashTable< T, Key, Hash > &)

Member Typedef Documentation

typedef Iterator< const T&, const HashTable<T, Key, Hash>&, const hashedEntry* > const_iterator
 

Reimplemented in HashPtrTable, HashPtrTable< IOobject >, HashPtrTable< tensorField >, HashPtrTable< curve >, HashPtrTable< sphericalTensorField >, HashPtrTable< scalarField >, HashPtrTable< reactionThermo >, HashPtrTable< T, label, Hash< label > >, HashPtrTable< ReactionThermo >, and HashPtrTable< vectorField >.

Definition at line 157 of file HashTable.H.

Referenced by HashTable::end(), HashTable::Iterator::operator!=(), and HashTable::Iterator::operator==().

typedef const T& const_reference
 

Type that can be used for storing into constant.

HashTable::value_type objects. This type is usually const HashTable::value_type&.

Definition at line 272 of file HashTable.H.

typedef Iterator< T&, HashTable<T, Key, Hash>&, hashedEntry* > iterator
 

Reimplemented in HashPtrTable, HashPtrTable< IOobject >, HashPtrTable< tensorField >, HashPtrTable< curve >, HashPtrTable< sphericalTensorField >, HashPtrTable< scalarField >, HashPtrTable< reactionThermo >, HashPtrTable< T, label, Hash< label > >, HashPtrTable< ReactionThermo >, and HashPtrTable< vectorField >.

Definition at line 150 of file HashTable.H.

Referenced by HashTable::Iterator::key(), HashTable::Iterator::operator==(), and HashTable::size().

typedef T& reference
 

Type that can be used for storing into HashTable::value_type.

objects. This type is usually List::value_type&.

Definition at line 265 of file HashTable.H.

typedef label size_type
 

The type that can represent the size of a HashTable.

Definition at line 275 of file HashTable.H.

typedef T value_type
 

Type of values the HashTable contains.

Definition at line 259 of file HashTable.H.


Constructor & Destructor Documentation

HashTable const label  size = 100  ) 
 

Construct given initial table size.

HashTable Istream ,
const label  size = 100
 

Construct from Istream.

HashTable const HashTable< T, Key, Hash > &   ) 
 

Construct as copy.

~HashTable  ) 
 


Member Function Documentation

HashTable< T, Key, Hash >::const_iterator begin  )  const [inline]
 

const_iterator set to the begining of the HashTable

Definition at line 309 of file HashTableI.H.

References Foam::Info.

HashTable< T, Key, Hash >::iterator begin  )  [inline]
 

iterator set to the begining of the HashTable

Definition at line 275 of file HashTableI.H.

References Foam::Info.

void clear  ) 
 

Clear all entries from table.

Reimplemented in HashPtrTable, HashPtrTable< IOobject >, HashPtrTable< tensorField >, HashPtrTable< curve >, HashPtrTable< sphericalTensorField >, HashPtrTable< scalarField >, HashPtrTable< reactionThermo >, HashPtrTable< T, label, Hash< label > >, HashPtrTable< ReactionThermo >, and HashPtrTable< vectorField >.

const HashTable< T, Key, Hash >::const_iterator & end  )  const [inline]
 

const_iterator set to beyond the end of the HashTable

Reimplemented in Time.

Definition at line 335 of file HashTableI.H.

const HashTable< T, Key, Hash >::iterator & end  )  [inline]
 

iterator set to beyond the end of the HashTable

Definition at line 301 of file HashTableI.H.

References HashTable::const_iterator, and Foam::label.

Referenced by HashTable::size().

bool erase const Key &  key  ) 
 

Erase an hashedEntry specified by given key if in table.

bool erase const iterator it  ) 
 

Erase an hashedEntry specified by given iterator.

const_iterator find const Key &  key  )  const
 

Find and return an const_iterator set at the hashedEntry.

If not found iterator = end()

iterator find const Key &  key  ) 
 

Find and return an iterator set at the hashedEntry.

If not found iterator = end()

Referenced by HashTable::size().

bool found const Key &  key  )  const
 

Return true if hashedEntry is found in table.

bool insert const Key &  key,
const T &  newElmt
 

Insert a new hashedEntry.

void operator= const HashTable< T, Key, Hash > &   ) 
 

Assignment.

const T & operator[] const Key &  key  )  const [inline]
 

Find and return an hashedEntry.

Reimplemented in NamedEnum, NamedEnum< typeOfMatch, 2 >, NamedEnum< algorithm, 3 >, NamedEnum< pointAction, 2 >, NamedEnum< setAction, 7 >, NamedEnum< cellAction, 1 >, NamedEnum< faceAction, 1 >, NamedEnum< pointAction, 1 >, NamedEnum< cellAction, 2 >, NamedEnum< stopAtControls, 4 >, NamedEnum< direction, 2 >, NamedEnum< writeControls, 5 >, NamedEnum< faceAction, 4 >, and NamedEnum< directionType, 3 >.

Definition at line 89 of file HashTableI.H.

References Foam::exit(), Foam::FatalError, FatalErrorIn, and HashTable::toc().

Here is the call graph for this function:

T & operator[] const Key &  key  )  [inline]
 

Find and return an hashedEntry.

Definition at line 73 of file HashTableI.H.

References Foam::exit(), Foam::FatalError, FatalErrorIn, and HashTable::toc().

Here is the call graph for this function:

void resize const label  newSize  ) 
 

Resize the hash table for efficiency.

label size  )  const [inline]
 

Return number of elements in table.

Definition at line 64 of file HashTableI.H.

References HashTable::end(), HashTable::find(), HashTable::iterator, and Foam::T().

Referenced by polyTopoChange::faceBalance(), polyTopoChange::pointBalance(), mapPolyMesh::pointZoneMap(), and GeoMesh< fvMesh >::size().

Here is the call graph for this function:

List<Key> toc  )  const
 

Return the table of contents.

Referenced by HashTable::operator[]().

void transfer HashTable< T, Key, Hash > &   ) 
 

Transfer the contents of the argument table into this table.

and annull the argument table.


Friends And Related Function Documentation

friend class HashPtrTable [friend]
 

Declare friendship with the HashPtrTable class.

Definition at line 137 of file HashTable.H.

friend class Iterator< const T&, const HashTable<T, Key, Hash>&, const hashedEntry* > [friend]
 

Definition at line 174 of file HashTable.H.

friend class Iterator< T&, HashTable<T, Key, Hash>&, hashedEntry* > [friend]
 

Definition at line 167 of file HashTable.H.

Ostream& operator Ostream ,
const HashTable< T, Key, Hash > & 
[friend]
 

Istream& operator>> Istream ,
HashTable< T, Key, Hash > & 
[friend]
 


The documentation for this class was generated from the following files:
For further information go to www.openfoam.org