FreeFOAM The Cross-Platform CFD Toolkit
HashPtrTable< T, Key, Hash > Class Template Reference

A HashTable specialization for hashing pointers. More...

#include <OpenFOAM/HashPtrTable.H>


Detailed Description

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

A HashTable specialization for hashing pointers.

Source files

Definition at line 65 of file HashPtrTable.H.

+ Inheritance diagram for HashPtrTable< T, Key, Hash >:
+ Collaboration diagram for HashPtrTable< T, Key, Hash >:

List of all members.

Public Types

typedef HashTable< T *, Key,
Hash >::iterator 
iterator
typedef HashTable< T *, Key,
Hash >::const_iterator 
const_iterator
- Public Types inherited from HashTable< T *, Key, Hash >
typedef Tvalue_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

 HashPtrTable (const label size=128)
 Construct given initial table size.
template<class INew >
 HashPtrTable (Istream &, const INew &)
 Construct from Istream using given Istream constructor class.
 HashPtrTable (Istream &)
 Construct from Istream using default Istream constructor class.
 HashPtrTable (const HashPtrTable< T, Key, Hash > &)
 Construct as copy.
 ~HashPtrTable ()
Tremove (iterator &)
 Remove and return the pointer specified by given iterator.
bool erase (iterator &)
 Erase an hashedEntry specified by given iterator.
void clear ()
 Clear all entries from table.
void operator= (const HashPtrTable< T, Key, Hash > &)
- Public Member Functions inherited from HashTable< T *, Key, Hash >
bool set (const Key &, const T *&newElmt)
 Assign a new hashedEntry, overwriting existing entries.
 HashTable (const label size=128)
 Construct given initial table size.
 HashTable (Istream &, const label size=128)
 Construct from Istream.
 HashTable (const HashTable< T *, Key, Hash > &)
 Construct as copy.
 HashTable (const Xfer< HashTable< T *, Key, Hash > > &)
 Construct by transferring the parameter contents.
 ~HashTable ()
label size () const
 Return number of elements in table.
bool empty () const
 Return true if the hash table is empty.
bool found (const Key &) const
 Return true if hashedEntry is found in table.
iterator find (const Key &)
 Find and return an iterator set at the hashedEntry.
const_iterator find (const Key &) const
 Find and return an const_iterator set at the hashedEntry.
List< Key > toc () const
 Return the table of contents.
List< Key > sortedToc () const
 Return the table of contents as a sorted list.
OstreamprintInfo (Ostream &) const
 Print information.
bool insert (const Key &, const T *&newElmt)
 Insert a new hashedEntry.
bool erase (const iterator &)
 Erase an hashedEntry specified by given iterator.
bool erase (const Key &)
 Erase an hashedEntry specified by given key if in table.
label erase (const UList< Key > &)
 Remove entries given by the listed keys from this HashTable.
label erase (const HashTable< AnyType, Key, AnyHash > &)
 Remove entries given by the given keys from this HashTable.
void resize (const label newSize)
 Resize the hash table for efficiency.
void clearStorage ()
 Clear the table entries and the table itself.
void transfer (HashTable< T *, Key, Hash > &)
 Transfer the contents of the argument table into this table.
Xfer< HashTable< T *, Key, Hash > > xfer ()
 Transfer contents to the Xfer container.
T *& operator[] (const Key &)
 Find and return an hashedEntry.
const T *& operator[] (const Key &) const
 Find and return an hashedEntry.
T *& operator() (const Key &)
 Find and return an hashedEntry, create it null if not present.
void operator= (const HashTable< T *, Key, Hash > &)
 Assignment.
bool operator== (const HashTable< T *, Key, Hash > &) const
 Equality. Two hash tables are equal if all contents of first are.
bool operator!= (const HashTable< T *, Key, Hash > &) const
 The opposite of the equality operation. Takes linear time.
iterator begin ()
 iterator set to the begining of the HashTable
const_iterator begin () const
 const_iterator set to the beginning of the HashTable
const iterator & end ()
 iterator set to beyond the end of the HashTable
const const_iterator & end () const
 const_iterator set to beyond the end of the HashTable
const_iterator cbegin () const
 const_iterator set to the beginning of the HashTable
const const_iterator & cend () const
 const_iterator set to beyond the end of the HashTable

Friends

Istreamoperator>> (Istream &, HashPtrTable< T, Key, Hash > &)
Ostreamoperator (Ostream &, const HashPtrTable< T, Key, Hash > &)

Member Typedef Documentation

typedef HashTable<T*, Key, Hash>::iterator iterator

Reimplemented from HashTable< T *, Key, Hash >.

Definition at line 78 of file HashPtrTable.H.

Reimplemented from HashTable< T *, Key, Hash >.

Definition at line 79 of file HashPtrTable.H.


Constructor & Destructor Documentation

HashPtrTable ( const label  size = 128)

Construct given initial table size.

Definition at line 33 of file HashPtrTable.C.

HashPtrTable ( Istream is,
const INew inewt 
)

Construct from Istream using given Istream constructor class.

Definition at line 144 of file HashPtrTableIO.C.

HashPtrTable ( Istream is)

Construct from Istream using default Istream constructor class.

Definition at line 151 of file HashPtrTableIO.C.

HashPtrTable ( const HashPtrTable< T, Key, Hash > &  ht)

Construct as copy.

Definition at line 42 of file HashPtrTable.C.

References HashTable< T *, Key, Hash >::begin(), HashTable< T *, Key, Hash >::end(), insert(), and Foam::T().

Definition at line 58 of file HashPtrTable.C.

References clear().


Member Function Documentation

T * remove ( iterator it)

Remove and return the pointer specified by given iterator.

Definition at line 67 of file HashPtrTable.C.

References HashTable< T, Key, Hash >::erase(), and Foam::T().

bool erase ( iterator it)

Erase an hashedEntry specified by given iterator.

Definition at line 76 of file HashPtrTable.C.

References Foam::T().

void clear ( )

Clear all entries from table.

Reimplemented from HashTable< T *, Key, Hash >.

Definition at line 97 of file HashPtrTable.C.

References HashTable< T, Key, Hash >::clear().

Referenced by Foam::operator>>().

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

Definition at line 117 of file HashPtrTable.C.

References Foam::abort(), clear(), Foam::FatalError, FatalErrorIn, insert(), and Foam::T().


Friends And Related Function Documentation

Istream& operator>> ( Istream ,
HashPtrTable< T, Key, Hash > &   
)
friend
Ostream& operator ( Ostream ,
const HashPtrTable< T, Key, Hash > &   
)
friend

The documentation for this class was generated from the following files: