A HashTable of pointers to objects of type <T>, with deallocation management of the pointers. More...
Public Types | |
typedef HashPtrTable< T, Key, Hash > | this_type |
The template instance used for this table. More... | |
typedef HashTable< T *, Key, Hash > | parent_type |
The template instance used for the parent HashTable. More... | |
using | iterator = typename parent_type::iterator |
using | const_iterator = typename parent_type::const_iterator |
Public Member Functions | |
HashPtrTable ()=default | |
Default construct with default table capacity. More... | |
HashPtrTable (const label size) | |
Construct given initial table capacity. More... | |
template<class INew > | |
HashPtrTable (Istream &is, const INew &inew) | |
Construct from Istream using given Istream constructor class. More... | |
HashPtrTable (Istream &is) | |
Construct from Istream using default Istream constructor class. More... | |
HashPtrTable (const dictionary &dict) | |
Construct from dictionary with default dictionary constructor class. More... | |
HashPtrTable (const this_type &rhs) | |
Copy construct, making a copy of each element. More... | |
HashPtrTable (this_type &&rhs) | |
Move construct. More... | |
~HashPtrTable () | |
Destructor. More... | |
const T * | get (const Key &key) const |
autoPtr< T > | release (iterator &iter) |
Release ownership of the pointer and replace with a nullptr. More... | |
autoPtr< T > | release (const Key &key) |
Release ownership of the pointer and replace with a nullptr. More... | |
autoPtr< T > | remove (iterator &iter) |
Remove entry specified by given iterator. More... | |
autoPtr< T > | remove (const Key &key) |
Remove entry specified by given key. More... | |
bool | erase (iterator &iter) |
bool | erase (const Key &key) |
void | clear () |
Clear all entries from table and delete any allocated pointers. More... | |
void | write (Ostream &os) const |
Invoke write() on each non-null entry. More... | |
void | operator= (const this_type &rhs) |
Copy assignment. More... | |
void | operator= (this_type &&rhs) |
Move assignment. More... | |
template<class... Args> | |
bool | emplace (const Key &key, Args &&... args) |
Emplace insert a new entry, not overwriting existing entries. More... | |
template<class... Args> | |
bool | emplace_set (const Key &key, Args &&... args) |
Emplace set an entry, overwriting any existing entries. More... | |
bool | insert (const Key &, T *)=delete |
bool | insert (const Key &key, autoPtr< T > &ptr) |
Insert a new entry, not overwriting existing entries. More... | |
bool | insert (const Key &key, autoPtr< T > &&ptr) |
Insert a new entry, not overwriting existing entries. More... | |
bool | insert (const Key &key, std::unique_ptr< T > &&ptr) |
Insert a new entry, not overwriting existing entries. More... | |
bool | set (const Key &key, T *ptr) |
Assign a new entry, overwriting existing entries. More... | |
bool | set (const Key &key, autoPtr< T > &ptr) |
Assign a new entry, overwriting existing entries. More... | |
bool | set (const Key &key, autoPtr< T > &&ptr) |
Assign a new entry, overwriting existing entries. More... | |
bool | set (const Key &key, std::unique_ptr< T > &&ptr) |
Assign a new entry, overwriting existing entries. More... | |
Friends | |
Istream & | operator>> (Istream &is, HashPtrTable< T, Key, Hash > &tbl) |
Clear table and read from Istream. More... | |
A HashTable of pointers to objects of type <T>, with deallocation management of the pointers.
Definition at line 54 of file HashPtrTable.H.
typedef HashPtrTable<T, Key, Hash> this_type |
The template instance used for this table.
Definition at line 83 of file HashPtrTable.H.
typedef HashTable<T*, Key, Hash> parent_type |
The template instance used for the parent HashTable.
Definition at line 86 of file HashPtrTable.H.
using iterator = typename parent_type::iterator |
Definition at line 88 of file HashPtrTable.H.
using const_iterator = typename parent_type::const_iterator |
Definition at line 89 of file HashPtrTable.H.
|
default |
Default construct with default table capacity.
|
inlineexplicit |
Construct given initial table capacity.
Definition at line 33 of file HashPtrTableI.H.
HashPtrTable | ( | Istream & | is, |
const INew & | inew | ||
) |
Construct from Istream using given Istream constructor class.
Definition at line 161 of file HashPtrTableIO.C.
HashPtrTable | ( | Istream & | is | ) |
Construct from Istream using default Istream constructor class.
Definition at line 168 of file HashPtrTableIO.C.
|
explicit |
Construct from dictionary with default dictionary constructor class.
Definition at line 175 of file HashPtrTableIO.C.
HashPtrTable | ( | const this_type & | rhs | ) |
Copy construct, making a copy of each element.
HashPtrTable | ( | this_type && | rhs | ) |
Move construct.
~HashPtrTable | ( | ) |
Destructor.
Definition at line 73 of file HashPtrTable.C.
|
inline |
Return const pointer associated with given entry, returning a nullptr if the key does not exist in the table.
Definition at line 42 of file HashPtrTableI.H.
Foam::autoPtr< T > release | ( | iterator & | iter | ) |
Release ownership of the pointer and replace with a nullptr.
Includes a safeguard against the end-iterator.
Definition at line 82 of file HashPtrTable.C.
Foam::autoPtr< T > release | ( | const Key & | key | ) |
Release ownership of the pointer and replace with a nullptr.
Definition at line 96 of file HashPtrTable.C.
Foam::autoPtr< T > remove | ( | iterator & | iter | ) |
Remove entry specified by given iterator.
Includes a safeguard against the end-iterator.
Definition at line 104 of file HashPtrTable.C.
Foam::autoPtr< T > remove | ( | const Key & | key | ) |
Remove entry specified by given key.
Definition at line 118 of file HashPtrTable.C.
Erase entry specified by given iterator and delete the allocated pointer.
Includes a safeguard against the end-iterator.
Definition at line 126 of file HashPtrTable.C.
bool erase | ( | const Key & | key | ) |
Erase entry specified by given key and delete the allocated pointer.
Definition at line 144 of file HashPtrTable.C.
void clear | ( | ) |
Clear all entries from table and delete any allocated pointers.
Definition at line 152 of file HashPtrTable.C.
void write | ( | Ostream & | os | ) | const |
Invoke write() on each non-null entry.
Definition at line 144 of file HashPtrTableIO.C.
void operator= | ( | const this_type & | rhs | ) |
Copy assignment.
Referenced by PtrMap< Foam::coordSystem::cylindrical >::operator=().
void operator= | ( | this_type && | rhs | ) |
Move assignment.
|
inline |
Emplace insert a new entry, not overwriting existing entries.
Definition at line 56 of file HashPtrTableI.H.
|
inline |
Emplace set an entry, overwriting any existing entries.
Definition at line 73 of file HashPtrTableI.H.
Insert a new entry, not overwriting existing entries.
Definition at line 84 of file HashPtrTableI.H.
Insert a new entry, not overwriting existing entries.
Definition at line 101 of file HashPtrTableI.H.
Insert a new entry, not overwriting existing entries.
Definition at line 118 of file HashPtrTableI.H.
Assign a new entry, overwriting existing entries.
Definition at line 135 of file HashPtrTableI.H.
Referenced by phaseSystem::addField(), exprResultGlobals::addValue(), phaseSystem::fillFields(), OneResistanceHeatTransferPhaseSystem< BasePhaseSystem >::heatTransfer(), TwoResistanceHeatTransferPhaseSystem< BasePhaseSystem >::heatTransfer(), PhaseTransferPhaseSystem< BasePhaseSystem >::massTransfer(), MomentumTransferPhaseSystem< BasePhaseSystem >::momentumTransfer(), and MomentumTransferPhaseSystem< BasePhaseSystem >::momentumTransferf().
Assign a new entry, overwriting existing entries.
Definition at line 155 of file HashPtrTableI.H.
Assign a new entry, overwriting existing entries.
Definition at line 166 of file HashPtrTableI.H.
Assign a new entry, overwriting existing entries.
Definition at line 177 of file HashPtrTableI.H.
|
friend |
Clear table and read from Istream.