OpenFOAM logo
The Open Source CFD Toolbox
  Programmer’s C++ Doxygen OpenCFD Solutions Contact OpenFOAM

HashTable Class Template Reference

Inheritance diagram for HashTable:

Inheritance graph
[legend]
Collaboration diagram for HashTable:

Collaboration graph
[legend]
List of all members.

Detailed Description

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

Definition at line 89 of file HashTable.H.


Public Types

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.
T & operator() (const Key &key)
 Find and return an hashedEntry and.
void operator= (const HashTable< T, Key, Hash > &)
 Assignment.
iterator begin ()
 iterator set to the begining of the HashTable
const iterator & end ()
 iterator set to beyond the end of the HashTable
const_iterator begin () const
 const_iterator set to the begining of the HashTable
const const_iterator & end () const
 const_iterator set to beyond the end of the HashTable

Friends

class HashPtrTable
 Declare friendship with the HashPtrTable class.
class iterator
class const_iterator
Istream & operator>> (Istream &, HashTable< T, Key, Hash > &)
Ostream & operator (Ostream &, const HashTable< T, Key, Hash > &)

Classes

class  const_iterator
struct  hashedEntry
class  iterator

Member Typedef Documentation

typedef T value_type

Type of values the HashTable contains.

Definition at line 237 of file HashTable.H.

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 243 of file HashTable.H.

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 250 of file HashTable.H.

typedef label size_type

The type that can represent the size of a HashTable.

Definition at line 253 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

label size (  )  const [inline]

Return number of elements in table.

Definition at line 64 of file HashTableI.H.

References HashTable::end(), and HashTable::find().

Here is the call graph for this function:

bool found ( const Key &  key  )  const

Return true if hashedEntry is found in table.

Referenced by cellFeatures::faceMap().

Here is the caller graph for this function:

iterator find ( const Key &  key  ) 

Find and return an iterator set at the hashedEntry.

If not found iterator = end()

Referenced by HashTable::operator()(), and HashTable::size().

Here is the caller graph for this function:

const_iterator find ( const Key &  key  )  const

Find and return an const_iterator set at the hashedEntry.

If not found iterator = end()

List<Key> toc (  )  const

Return the table of contents.

Referenced by HashTable::operator[]().

Here is the caller graph for this function:

bool insert ( const Key &  key,
const T &  newElmt 
)

Insert a new hashedEntry.

Referenced by HashTable::operator()().

Here is the caller graph for this function:

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 transfer ( HashTable< T, Key, Hash > &   ) 

Transfer the contents of the argument table into this table.

and annull the argument table.

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:

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

Find and return an hashedEntry and.

if it is not present create it null.

Definition at line 106 of file HashTableI.H.

References HashTable::find(), HashTable::insert(), and Foam::T().

Here is the call graph for this function:

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

Assignment.

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

iterator set to the begining of the HashTable

Definition at line 256 of file HashTableI.H.

References Foam::Info.

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

iterator set to beyond the end of the HashTable

Definition at line 282 of file HashTableI.H.

Referenced by HashTable::size().

Here is the caller graph for this function:

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

const_iterator set to the begining of the HashTable

Definition at line 427 of file HashTableI.H.

References Foam::Info.

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 453 of file HashTableI.H.


Friends And Related Function Documentation

friend class HashPtrTable [friend]

Declare friendship with the HashPtrTable class.

Definition at line 137 of file HashTable.H.

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

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


The documentation for this class was generated from the following files: Copyright © 2000-2007 OpenCFD Ltd