PtrMap< T > Class Template Reference

A HashTable of pointers to objects of type <T> with a label key. More...

Inheritance diagram for PtrMap< T >:
Collaboration diagram for PtrMap< T >:

Public Member Functions

 PtrMap (const label size=128)
 Construct given initial map size. More...
 
 PtrMap (Istream &is)
 Construct from Istream. More...
 
 PtrMap (const PtrMap< T > &map)
 Copy construct. More...
 
 PtrMap (PtrMap< T > &&map)
 Move constructor. More...
 
void operator= (const PtrMap< T > &map)
 
void operator= (PtrMap< T > &&map)
 
- Public Member Functions inherited from HashPtrTable< T, label, Hash< label > >
 HashPtrTable (const label size=128)
 Construct given initial table size. More...
 
 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, label, Hash< label > > &)
 Copy constructor. More...
 
 HashPtrTable (HashPtrTable< T, label, Hash< label > > &&)
 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, label, Hash< label > > &)
 Assignment operator. More...
 
void operator= (HashPtrTable< T, label, Hash< label > > &&)
 Move assignment operator. More...
 
- Public Member Functions inherited from HashTable< T, Key, Hash >
 HashTable (const label size=128)
 Construct given initial table size. More...
 
 HashTable (Istream &, const label size=128)
 Construct from Istream. More...
 
 HashTable (const HashTable< T, Key, Hash > &)
 Copy constructor. More...
 
 HashTable (HashTable< T, Key, Hash > &&)
 Move constructor. More...
 
 HashTable (std::initializer_list< Tuple2< Key, T >>)
 Construct from an initializer 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 Key &) const
 Return true if hashedEntry is found in table. More...
 
iterator find (const Key &)
 Find and return an iterator set at the hashedEntry. More...
 
const_iterator find (const Key &) const
 Find and return an const_iterator set at the hashedEntry. More...
 
List< Key > toc () const
 Return the table of contents. More...
 
List< Key > sortedToc () const
 Return the table of contents as a sorted list. More...
 
OstreamprintInfo (Ostream &) const
 Print information. More...
 
bool insert (const Key &, const T &newElmt)
 Insert a new hashedEntry. More...
 
bool set (const Key &, const T &newElmt)
 Assign a new hashedEntry, overwriting existing entries. More...
 
bool erase (const iterator &)
 Erase a hashedEntry specified by given iterator. More...
 
bool erase (const Key &)
 Erase a hashedEntry specified by the given key. More...
 
label erase (const UList< Key > &)
 Remove entries given by the listed keys from this HashTable. More...
 
template<class AnyType , class AnyHash >
label erase (const HashTable< AnyType, Key, AnyHash > &)
 Remove entries given by the given keys from this HashTable. More...
 
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, Key, Hash > &)
 Transfer the contents of the argument table into this table. More...
 
Toperator[] (const Key &)
 Find and return a hashedEntry. More...
 
const Toperator[] (const Key &) const
 Find and return a hashedEntry. More...
 
Toperator() (const Key &)
 Find and return a hashedEntry, create it null if not present. More...
 
void operator= (const HashTable< T, Key, Hash > &)
 Assignment operator. More...
 
void operator= (HashTable< T, Key, Hash > &&)
 Move assignment operator. More...
 
void operator= (std::initializer_list< Tuple2< Key, T >>)
 Assignment to an initializer list. More...
 
bool operator== (const HashTable< T, Key, Hash > &) const
 Equality. Hash tables are equal if the keys and values are equal. More...
 
bool operator!= (const HashTable< T, Key, 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 cbegin () const
 const_iterator set to the beginning of the HashTable More...
 
const_iterator begin () const
 const_iterator set to the beginning of the HashTable More...
 
template<class AnyType , class AnyHash >
Foam::label erase (const HashTable< AnyType, Key, AnyHash > &rhs)
 
- Public Member Functions inherited from HashTableCore
 HashTableCore ()
 Construct null. More...
 
 ClassName ("HashTable")
 Define template name and debug. More...
 

Additional Inherited Members

- Public Types inherited from HashPtrTable< T, label, Hash< label > >
typedef HashTable< T *, label, Hash< label > >::iterator iterator
 
typedef HashTable< T *, label, Hash< label > >::const_iterator const_iterator
 
- Public Types inherited from HashTable< T, Key, Hash >
typedef T value_type
 Type of values the HashTable contains. More...
 
typedef Treference
 Type that can be used for storing into HashTable::value_type. More...
 
typedef const Tconst_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...
 
- 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 Foam::PtrMap< T >

A HashTable of pointers to objects of type <T> with a label key.

See also
Map, HashPtrTable

Definition at line 49 of file PtrMap.H.

Constructor & Destructor Documentation

◆ PtrMap() [1/4]

PtrMap ( const label  size = 128)
inline

Construct given initial map size.

Definition at line 59 of file PtrMap.H.

◆ PtrMap() [2/4]

PtrMap ( Istream is)
inline

Construct from Istream.

Definition at line 65 of file PtrMap.H.

◆ PtrMap() [3/4]

PtrMap ( const PtrMap< T > &  map)
inline

Copy construct.

Definition at line 71 of file PtrMap.H.

◆ PtrMap() [4/4]

PtrMap ( PtrMap< T > &&  map)
inline

Move constructor.

Definition at line 77 of file PtrMap.H.

Member Function Documentation

◆ operator=() [1/2]

void operator= ( const PtrMap< T > &  map)
inline

Definition at line 85 of file PtrMap.H.

References HashPtrTable< T, label, Hash< label > >::operator.

◆ operator=() [2/2]

void operator= ( PtrMap< T > &&  map)
inline

Definition at line 90 of file PtrMap.H.

References HashPtrTable< T, label, Hash< label > >::operator.


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