HashPtrTable< T, Key, Hash > Class Template Reference

A HashTable specialisation for hashing pointers. More...

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

Public Types

typedef HashTable< T *, Key, Hash >::iterator iterator
 
typedef HashTable< T *, Key, Hash >::const_iterator const_iterator
 
- Public Types inherited from HashTable< T *, word, string::hash >
typedef T * value_type
 Type of values the HashTable contains. More...
 
typedef T * & reference
 Type that can be used for storing into HashTable::value_type. More...
 
typedef const T * & const_reference
 Type that can be used for storing into constant. More...
 
typedef label size_type
 The type that can represent the size of a HashTable. More...
 

Public Member Functions

 HashPtrTable (const label size=128)
 Construct given initial table size. More...
 
template<class INew >
 HashPtrTable (Istream &, const INew &)
 Construct from Istream using given Istream constructor class. More...
 
 HashPtrTable (Istream &)
 Construct from Istream using default Istream constructor class. More...
 
 HashPtrTable (const dictionary &)
 Construct from dictionary using default dictionary constructor. More...
 
 HashPtrTable (const HashPtrTable< T, Key, Hash > &)
 Copy constructor. More...
 
 HashPtrTable (HashPtrTable< T, Key, Hash > &&)
 Move constructor. More...
 
 ~HashPtrTable ()
 Destructor. More...
 
Tremove (iterator &)
 Remove and return the pointer specified by given iterator. More...
 
bool erase (iterator &)
 Erase an hashedEntry specified by given iterator. More...
 
void clear ()
 Clear all entries from table. More...
 
void write (Ostream &os) const
 Write. More...
 
void operator= (const HashPtrTable< T, Key, Hash > &)
 Assignment operator. More...
 
void operator= (HashPtrTable< T, Key, Hash > &&)
 Move assignment operator. More...
 
- Public Member Functions inherited from HashTable< T *, word, string::hash >
bool set (const word &, const T * &newElmt)
 Set a new hashedEntry, overwriting existing entries. More...
 
void set (const HashTable< T *, word, string::hash > &)
 Insert all the entries from the given HashTable,. More...
 
 HashTable (const label size=128)
 Construct given initial table size. More...
 
 HashTable (Istream &, const label size=128)
 Construct from Istream. More...
 
 HashTable (const UList< word > &keyList, const UList< T * > &elmtList)
 Construct from a list of keys and list of elements. More...
 
 HashTable (const HashTable< T *, word, string::hash > &)
 Copy constructor. More...
 
 HashTable (HashTable< T *, word, string::hash > &&)
 Move constructor. More...
 
 HashTable (std::initializer_list< Tuple2< word, T * >>)
 Construct from an initialiser list. More...
 
 ~HashTable ()
 Destructor. More...
 
label capacity () const
 The size of the underlying table. More...
 
label size () const
 Return number of elements in table. More...
 
bool empty () const
 Return true if the hash table is empty. More...
 
bool found (const word &) const
 Return true if hashedEntry is found in table. More...
 
iterator find (const word &)
 Find and return an iterator set at the hashedEntry. More...
 
const_iterator find (const word &) const
 Find and return an const_iterator set at the hashedEntry. More...
 
List< wordtoc () const
 Return the table of contents. More...
 
List< wordsortedToc () const
 Return the table of contents as a sorted list. More...
 
List< const_iteratorsorted () const
 Return a sorted list of constant iterators. More...
 
OstreamprintInfo (Ostream &) const
 Print information. More...
 
bool insert (const word &, const T * &newElmt)
 Insert a new hashedEntry. More...
 
void insert (const HashTable< T *, word, string::hash > &)
 Insert all the entries from the given HashTable. More...
 
bool erase (const iterator &)
 Erase a hashedEntry specified by given iterator. More...
 
bool erase (const word &)
 Erase a hashedEntry specified by the given key. More...
 
label erase (const UList< word > &)
 Remove entries given by the listed keys from this HashTable. More...
 
label erase (const HashTable< AnyType, word, AnyHash > &)
 Remove entries given by the given keys from this HashTable. More...
 
Foam::label erase (const HashTable< AnyType, word, AnyHash > &rhs)
 
void resize (const label newSize)
 Resize the hash table for efficiency. More...
 
void clear ()
 Clear all entries from table. More...
 
void clearStorage ()
 Clear the table entries and the table itself. More...
 
void shrink ()
 Shrink the allocated table to approx. twice number of elements. More...
 
void transfer (HashTable< T *, word, string::hash > &)
 Transfer the contents of the argument table into this table. More...
 
T * & operator[] (const word &)
 Find and return a hashedEntry. More...
 
const T * & operator[] (const word &) const
 Find and return a hashedEntry. More...
 
T * & operator() (const word &)
 Find and return a hashedEntry, create it null if not present. More...
 
void operator= (const HashTable< T *, word, string::hash > &)
 Assignment operator. More...
 
void operator= (HashTable< T *, word, string::hash > &&)
 Move assignment operator. More...
 
void operator= (std::initializer_list< Tuple2< word, T * >>)
 Assignment to an initialiser list. More...
 
bool operator== (const HashTable< T *, word, string::hash > &) const
 Equality. Hash tables are equal if the keys and values are equal. More...
 
bool operator!= (const HashTable< T *, word, string::hash > &) const
 The opposite of the equality operation. Takes linear time. More...
 
iterator begin ()
 Iterator set to the beginning of the HashTable. More...
 
const_iterator begin () const
 const_iterator set to the beginning of the HashTable More...
 
const_iterator cbegin () const
 const_iterator set to the beginning of the HashTable More...
 
- Public Member Functions inherited from HashTableCore
 HashTableCore ()
 Construct null. More...
 
 ClassName ("HashTable")
 Define template name and debug. More...
 

Friends

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

Additional Inherited Members

- Static Public Member Functions inherited from HashTableCore
static label canonicalSize (const label)
 Return a canonical (power-of-two) size. More...
 
static iteratorEnd cend ()
 iteratorEnd set to beyond the end of any HashTable More...
 
static iteratorEnd end ()
 iteratorEnd set to beyond the end of any HashTable More...
 
- Static Public Attributes inherited from HashTableCore
static const label maxTableSize
 Maximum allowable table size. More...
 

Detailed Description

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

A HashTable specialisation for hashing pointers.

Source files

Definition at line 64 of file HashPtrTable.H.

Member Typedef Documentation

◆ iterator

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

Definition at line 82 of file HashPtrTable.H.

◆ const_iterator

Definition at line 83 of file HashPtrTable.H.

Constructor & Destructor Documentation

◆ HashPtrTable() [1/6]

HashPtrTable ( const label  size = 128)

Construct given initial table size.

Definition at line 32 of file HashPtrTable.C.

◆ HashPtrTable() [2/6]

HashPtrTable ( Istream is,
const INew inewt 
)

Construct from Istream using given Istream constructor class.

Definition at line 179 of file HashPtrTableIO.C.

References Foam::blockMeshTools::read().

Here is the call graph for this function:

◆ HashPtrTable() [3/6]

HashPtrTable ( Istream is)

Construct from Istream using default Istream constructor class.

Definition at line 186 of file HashPtrTableIO.C.

References Foam::blockMeshTools::read().

Here is the call graph for this function:

◆ HashPtrTable() [4/6]

HashPtrTable ( const dictionary dict)

Construct from dictionary using default dictionary constructor.

class

Definition at line 193 of file HashPtrTableIO.C.

References Foam::blockMeshTools::read().

Here is the call graph for this function:

◆ HashPtrTable() [5/6]

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

Copy constructor.

Definition at line 39 of file HashPtrTable.C.

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

Here is the call graph for this function:

◆ HashPtrTable() [6/6]

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

Move constructor.

Definition at line 54 of file HashPtrTable.C.

◆ ~HashPtrTable()

Destructor.

Definition at line 66 of file HashPtrTable.C.

References clear().

Here is the call graph for this function:

Member Function Documentation

◆ remove()

T * remove ( iterator it)

Remove and return the pointer specified by given iterator.

Definition at line 75 of file HashPtrTable.C.

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

Here is the call graph for this function:

◆ erase()

bool erase ( iterator it)

Erase an hashedEntry specified by given iterator.

Definition at line 84 of file HashPtrTable.C.

References Foam::T().

Here is the call graph for this function:

◆ clear()

void clear

Clear all entries from table.

Definition at line 105 of file HashPtrTable.C.

◆ write()

void write ( Ostream os) const

Write.

Definition at line 158 of file HashPtrTableIO.C.

References Foam::T().

Here is the call graph for this function:

◆ operator=() [1/2]

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

Assignment operator.

Definition at line 124 of file HashPtrTable.C.

◆ operator=() [2/2]

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

Move assignment operator.

Definition at line 147 of file HashPtrTable.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, and HashTable< T, Key, Hash >::operator=().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator>>

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

◆ operator

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

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