Base dictionary class templated on both the form of doubly-linked list it uses as well as the type it holds. More...
Public Member Functions | |
DictionaryBase ()=default | |
Default construct: empty without allocation (capacity=0). More... | |
DictionaryBase (const label initialCapacity) | |
Construct empty with initial table capacity. More... | |
DictionaryBase (const DictionaryBase &dict) | |
Copy construct. More... | |
template<class INew > | |
DictionaryBase (Istream &is, const INew &inew) | |
Construct from Istream using given Istream constructor class. More... | |
DictionaryBase (Istream &is) | |
Construct from Istream using default Istream constructor class. More... | |
bool | contains (const word &keyword) const |
Search for given keyword. More... | |
const T * | cfind (const word &keyword) const |
Find and return an entry, nullptr on failure. More... | |
T * | find (const word &keyword) |
Find and return an entry, nullptr on failure. More... | |
const T * | lookup (const word &keyword) const |
Find and return entry, FatalError on failure. More... | |
T * | lookup (const word &keyword) |
Find and return entry, FatalError on failure. More... | |
wordList | toc () const |
The table of contents (as a sorted list) More... | |
wordList | sortedToc () const |
The table of contents as a sorted list. More... | |
template<class Compare > | |
wordList | sortedToc (const Compare &comp) const |
The table of contents sorted using the specified comparator. More... | |
void | push_front (const word &keyword, T *ptr) |
Add to front of dictionary. More... | |
void | push_back (const word &keyword, T *ptr) |
Add to back of dictionary. More... | |
T * | remove (const word &keyword) |
Remove and return entry specified by keyword. More... | |
void | clear () |
Clear the dictionary. More... | |
void | transfer (DictionaryBase< IDLListType, T > &dict) |
Transfer the contents of the argument into this DictionaryBase. More... | |
void | operator= (const DictionaryBase &) |
Copy assignment. More... | |
const T * | operator[] (const word &key) const |
Find and return entry. More... | |
T * | operator[] (const word &key) |
Find and return entry. More... | |
bool | found (const word &key) const |
Same as contains() More... | |
const T * | lookupPtr (const word &k) const |
Deprecated(2020-03) use cfind() More... | |
T * | lookupPtr (const word &k) |
Deprecated(2020-03) use find() More... | |
void | insert (const word &k, T *ptr) |
Add to front of dictionary. More... | |
void | prepend (const word &k, T *ptr) |
Add to front of dictionary. More... | |
void | append (const word &k, T *ptr) |
Add to back of dictionary. More... | |
Protected Member Functions | |
bool | addHashEntry (const word &key, T *ptr) |
Add an entry to the HashTable. More... | |
void | addEntries () |
Add the IDLListType entries into the HashTable. More... | |
Protected Attributes | |
HashTable< T * > | hashedTs_ |
HashTable of the entries held on the IDLListType for quick lookup. More... | |
Friends | |
Ostream & | operator (Ostream &, const DictionaryBase< IDLListType, T > &) |
Base dictionary class templated on both the form of doubly-linked list it uses as well as the type it holds.
The double templating allows for the instantiation of forms with or without storage management.
Definition at line 60 of file DictionaryBase.H.
|
default |
Default construct: empty without allocation (capacity=0).
|
inlineexplicit |
Construct empty with initial table capacity.
Definition at line 113 of file DictionaryBase.H.
DictionaryBase | ( | const DictionaryBase< IDLListType, T > & | dict | ) |
Copy construct.
Definition at line 40 of file DictionaryBase.C.
DictionaryBase | ( | Istream & | is, |
const INew & | inew | ||
) |
Construct from Istream using given Istream constructor class.
Definition at line 53 of file DictionaryBase.C.
DictionaryBase | ( | Istream & | is | ) |
Construct from Istream using default Istream constructor class.
Definition at line 65 of file DictionaryBase.C.
Add an entry to the HashTable.
Definition at line 90 of file DictionaryBase.H.
|
protected |
Add the IDLListType entries into the HashTable.
Definition at line 27 of file DictionaryBase.C.
bool contains | ( | const word & | keyword | ) | const |
Search for given keyword.
Definition at line 76 of file DictionaryBase.C.
Referenced by DictionaryBase< DLPtrList< T >, T >::found().
Find and return an entry, nullptr on failure.
Definition at line 84 of file DictionaryBase.C.
Referenced by DictionaryBase< DLPtrList< T >, T >::lookupPtr().
Find and return an entry, nullptr on failure.
Definition at line 100 of file DictionaryBase.C.
Referenced by Foam::appendNamedEntry(), DictionaryBase< DLPtrList< T >, T >::lookupPtr(), and Time::readDict().
Find and return entry, FatalError on failure.
Definition at line 114 of file DictionaryBase.C.
Referenced by DictionaryBase< DLPtrList< T >, T >::operator[]().
Find and return entry, FatalError on failure.
Definition at line 130 of file DictionaryBase.C.
|
inline |
The table of contents (as a sorted list)
Definition at line 167 of file DictionaryBase.H.
|
inline |
The table of contents as a sorted list.
Definition at line 175 of file DictionaryBase.H.
|
inline |
The table of contents sorted using the specified comparator.
Definition at line 184 of file DictionaryBase.H.
Add to front of dictionary.
Definition at line 147 of file DictionaryBase.C.
Referenced by DictionaryBase< DLPtrList< T >, T >::insert(), and DictionaryBase< DLPtrList< T >, T >::prepend().
Add to back of dictionary.
Definition at line 160 of file DictionaryBase.C.
Referenced by DictionaryBase< DLPtrList< T >, T >::append().
Remove and return entry specified by keyword.
Return nullptr if the keyword was not found.
Definition at line 172 of file DictionaryBase.C.
void clear | ( | ) |
Clear the dictionary.
Definition at line 187 of file DictionaryBase.C.
void transfer | ( | DictionaryBase< IDLListType, T > & | dict | ) |
Transfer the contents of the argument into this DictionaryBase.
and annul the argument.
Definition at line 196 of file DictionaryBase.C.
void operator= | ( | const DictionaryBase< IDLListType, T > & | ) |
Copy assignment.
Definition at line 214 of file DictionaryBase.C.
Find and return entry.
Definition at line 232 of file DictionaryBase.H.
Find and return entry.
Definition at line 240 of file DictionaryBase.H.
|
inline |
Same as contains()
Definition at line 260 of file DictionaryBase.H.
Deprecated(2020-03) use cfind()
Definition at line 268 of file DictionaryBase.H.
Deprecated(2020-03) use find()
Definition at line 276 of file DictionaryBase.H.
Add to front of dictionary.
FOAM_DEPRECATED_FOR(2022-10, "push_front()")
Definition at line 283 of file DictionaryBase.H.
Add to front of dictionary.
FOAM_DEPRECATED_FOR(2022-10, "push_front()")
Definition at line 290 of file DictionaryBase.H.
Add to back of dictionary.
FOAM_DEPRECATED_FOR(2022-10, "push_back()")
Definition at line 297 of file DictionaryBase.H.
Referenced by Foam::appendNamedEntry().
|
friend |
HashTable of the entries held on the IDLListType for quick lookup.
Definition at line 82 of file DictionaryBase.H.
Referenced by DictionaryBase< DLPtrList< T >, T >::addHashEntry(), DictionaryBase< DLPtrList< T >, T >::sortedToc(), and DictionaryBase< DLPtrList< T >, T >::toc().