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 (const label size=128) | |
Construct with given or default (128) 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 | found (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 |
Return the table of contents (as a sorted list) More... | |
wordList | sortedToc () const |
Return the table of contents as a sorted list. More... | |
template<class Compare > | |
wordList | sortedToc (const Compare &comp) const |
Return table of contents sorted using the specified comparator. More... | |
void | insert (const word &keyword, T *) |
Add at head of dictionary. More... | |
void | append (const word &keyword, T *) |
Add at tail 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... | |
const T * | lookupPtr (const word &keyword) const |
Deprecated(2020-03) use cfind() More... | |
T * | lookupPtr (const word &keyword) |
Deprecated(2020-03) use find() More... | |
template<class Compare > | |
Foam::wordList | sortedToc (const Compare &comp) const |
Protected Member Functions | |
void | addEntries () |
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 64 of file DictionaryBase.H.
|
explicit |
Construct with given or default (128) table capacity.
Definition at line 46 of file DictionaryBase.C.
DictionaryBase | ( | const DictionaryBase< IDLListType, T > & | dict | ) |
Copy construct.
Definition at line 54 of file DictionaryBase.C.
DictionaryBase | ( | Istream & | is, |
const INew & | inew | ||
) |
Construct from Istream using given Istream constructor class.
Definition at line 67 of file DictionaryBase.C.
DictionaryBase | ( | Istream & | is | ) |
Construct from Istream using default Istream constructor class.
Definition at line 79 of file DictionaryBase.C.
|
protected |
Definition at line 34 of file DictionaryBase.C.
Search for given keyword.
Definition at line 90 of file DictionaryBase.C.
Find and return an entry, nullptr on failure.
Definition at line 98 of file DictionaryBase.C.
Referenced by DictionaryBase< IDLList< simpleObjectRegistryEntry >, simpleObjectRegistryEntry >::lookupPtr().
Find and return an entry, nullptr on failure.
Definition at line 114 of file DictionaryBase.C.
Referenced by Foam::appendNamedEntry(), DictionaryBase< IDLList< simpleObjectRegistryEntry >, simpleObjectRegistryEntry >::lookupPtr(), and Time::readDict().
Find and return entry, FatalError on failure.
Definition at line 128 of file DictionaryBase.C.
Referenced by DictionaryBase< IDLList< simpleObjectRegistryEntry >, simpleObjectRegistryEntry >::operator[]().
Find and return entry, FatalError on failure.
Definition at line 144 of file DictionaryBase.C.
Foam::wordList toc | ( | ) | const |
Return the table of contents (as a sorted list)
Definition at line 160 of file DictionaryBase.C.
Foam::wordList sortedToc | ( | ) | const |
Return the table of contents as a sorted list.
Definition at line 170 of file DictionaryBase.C.
wordList sortedToc | ( | const Compare & | comp | ) | const |
Return table of contents sorted using the specified comparator.
Add at head of dictionary.
Definition at line 188 of file DictionaryBase.C.
Add at tail of dictionary.
Definition at line 197 of file DictionaryBase.C.
Referenced by Foam::appendNamedEntry().
Remove and return entry specified by keyword.
Return nullptr if the keyword was not found.
Definition at line 206 of file DictionaryBase.C.
void clear | ( | ) |
Clear the dictionary.
Definition at line 222 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 231 of file DictionaryBase.C.
void operator= | ( | const DictionaryBase< IDLListType, T > & | ) |
Copy assignment.
Definition at line 249 of file DictionaryBase.C.
Find and return entry.
Definition at line 167 of file DictionaryBase.H.
Find and return entry.
Definition at line 173 of file DictionaryBase.H.
Deprecated(2020-03) use cfind()
Definition at line 194 of file DictionaryBase.H.
Deprecated(2020-03) use find()
Definition at line 203 of file DictionaryBase.H.
Foam::wordList sortedToc | ( | const Compare & | comp | ) | const |
Definition at line 179 of file DictionaryBase.C.
|
friend |
HashTable of the entries held on the IDLListType for quick lookup.
Definition at line 84 of file DictionaryBase.H.