DictionaryBase< IDLListType, T > Class Template Reference

Base dictionary class templated on both the form of doubly-linked list it uses as well as the type it holds. More...

Inheritance diagram for DictionaryBase< IDLListType, T >:
[legend]
Collaboration diagram for DictionaryBase< IDLListType, T >:
[legend]

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 Tcfind (const word &keyword) const
 Find and return an entry, nullptr on failure. More...
 
Tfind (const word &keyword)
 Find and return an entry, nullptr on failure. More...
 
const Tlookup (const word &keyword) const
 Find and return entry, FatalError on failure. More...
 
Tlookup (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 prepend (const word &keyword, T *ptr)
 Add to front of dictionary. More...
 
void append (const word &keyword, T *ptr)
 Add to back of dictionary. More...
 
Tremove (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 Toperator[] (const word &key) const
 Find and return entry. More...
 
Toperator[] (const word &key)
 Find and return entry. More...
 
const TlookupPtr (const word &keyword) const
 Deprecated(2020-03) use cfind() More...
 
TlookupPtr (const word &keyword)
 Deprecated(2020-03) use find() More...
 
void insert (const word &keyword, T *ptr)
 Add to front of dictionary. 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

Ostreamoperator (Ostream &, const DictionaryBase< IDLListType, T > &)
 

Detailed Description

template<class IDLListType, class T>
class Foam::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.

Note
The IDLListType parameter should itself be a template but this confused gcc 2.95.2 so it has to be instantiated for T when an instantiation of DictionaryBase is requested
See also
Dictionary and UDictionary
Source files

Definition at line 75 of file DictionaryBase.H.

Constructor & Destructor Documentation

◆ DictionaryBase() [1/4]

DictionaryBase ( const label  size = 128)
explicit

Construct with given or default (128) table capacity.

Definition at line 46 of file DictionaryBase.C.

◆ DictionaryBase() [2/4]

DictionaryBase ( const DictionaryBase< IDLListType, T > &  dict)

Copy construct.

Definition at line 53 of file DictionaryBase.C.

References DictionaryBase< IDLListType, T >::addEntries().

Here is the call graph for this function:

◆ DictionaryBase() [3/4]

DictionaryBase ( Istream is,
const INew inew 
)

Construct from Istream using given Istream constructor class.

Definition at line 66 of file DictionaryBase.C.

References DictionaryBase< IDLListType, T >::addEntries().

Here is the call graph for this function:

◆ DictionaryBase() [4/4]

Construct from Istream using default Istream constructor class.

Definition at line 79 of file DictionaryBase.C.

References DictionaryBase< IDLListType, T >::addEntries().

Here is the call graph for this function:

Member Function Documentation

◆ addEntries()

void addEntries
protected

Definition at line 34 of file DictionaryBase.C.

Referenced by DictionaryBase< IDLListType, T >::DictionaryBase().

Here is the caller graph for this function:

◆ found()

bool found ( const word keyword) const

Search for given keyword.

Definition at line 90 of file DictionaryBase.C.

◆ cfind()

const T * cfind ( const word keyword) const

Find and return an entry, nullptr on failure.

Definition at line 97 of file DictionaryBase.C.

Referenced by DictionaryBase< IDLListType, T >::lookupPtr().

Here is the caller graph for this function:

◆ find()

T * find ( const word keyword)

Find and return an entry, nullptr on failure.

Definition at line 114 of file DictionaryBase.C.

Referenced by Foam::appendNamedEntry(), DictionaryBase< IDLListType, T >::lookupPtr(), Time::readDict(), and simpleObjectRegistry::setValues().

Here is the caller graph for this function:

◆ lookup() [1/2]

const T * lookup ( const word keyword) const

Find and return entry, FatalError on failure.

Definition at line 128 of file DictionaryBase.C.

◆ lookup() [2/2]

T * lookup ( const word keyword)

Find and return entry, FatalError on failure.

Definition at line 144 of file DictionaryBase.C.

◆ toc()

Return the table of contents (as a sorted list)

Definition at line 160 of file DictionaryBase.C.

Referenced by phaseSystem::phaseSystem().

Here is the caller graph for this function:

◆ sortedToc() [1/3]

Foam::wordList sortedToc

Return the table of contents as a sorted list.

Definition at line 170 of file DictionaryBase.C.

◆ sortedToc() [2/3]

wordList sortedToc ( const Compare &  comp) const

Return table of contents sorted using the specified comparator.

◆ prepend()

void prepend ( const word keyword,
T ptr 
)

Add to front of dictionary.

Definition at line 188 of file DictionaryBase.C.

Referenced by DictionaryBase< IDLListType, T >::insert().

Here is the caller graph for this function:

◆ append()

void append ( const word keyword,
T ptr 
)

Add to back of dictionary.

Definition at line 197 of file DictionaryBase.C.

Referenced by Foam::appendNamedEntry().

Here is the caller graph for this function:

◆ remove()

T * remove ( const word keyword)

Remove and return entry specified by keyword.

Return nullptr if the keyword was not found.

Definition at line 206 of file DictionaryBase.C.

References T.

◆ clear()

void clear

Clear the dictionary.

Definition at line 222 of file DictionaryBase.C.

◆ transfer()

void transfer ( DictionaryBase< IDLListType, T > &  dict)

Transfer the contents of the argument into this DictionaryBase.

and annul the argument.

Definition at line 230 of file DictionaryBase.C.

References dict.

◆ operator=()

void operator= ( const DictionaryBase< IDLListType, T > &  )

Copy assignment.

Definition at line 248 of file DictionaryBase.C.

References dict.

◆ operator[]() [1/2]

const T * operator[] ( const word key) const
inline

Find and return entry.

Definition at line 167 of file DictionaryBase.H.

◆ operator[]() [2/2]

T * operator[] ( const word key)
inline

Find and return entry.

Definition at line 173 of file DictionaryBase.H.

◆ lookupPtr() [1/2]

const T * lookupPtr ( const word keyword) const
inline

Deprecated(2020-03) use cfind()

Deprecated:
(2020-03) - use cfind() method

Definition at line 193 of file DictionaryBase.H.

References DictionaryBase< IDLListType, T >::cfind().

Here is the call graph for this function:

◆ lookupPtr() [2/2]

T * lookupPtr ( const word keyword)
inline

Deprecated(2020-03) use find()

Deprecated:
(2020-03) - use find() method

Definition at line 201 of file DictionaryBase.H.

References DictionaryBase< IDLListType, T >::find().

Here is the call graph for this function:

◆ insert()

void insert ( const word keyword,
T ptr 
)
inline

Add to front of dictionary.

Definition at line 207 of file DictionaryBase.H.

References DictionaryBase< IDLListType, T >::prepend().

Here is the call graph for this function:

◆ sortedToc() [3/3]

Foam::wordList sortedToc ( const Compare &  comp) const

Definition at line 178 of file DictionaryBase.C.

Friends And Related Function Documentation

◆ operator

Ostream & operator ( Ostream ,
const DictionaryBase< IDLListType, T > &   
)
friend

Member Data Documentation

◆ hashedTs_

HashTable<T*> hashedTs_
protected

HashTable of the entries held on the IDLListType for quick lookup.

Definition at line 84 of file DictionaryBase.H.


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