Go to the documentation of this file.
24 #ifndef __dictionary_hpp__
25 #define __dictionary_hpp__
363 if(
auto entry = findEntry(keyword); entry!=
nullptr && !entry->isDictionary() )
384 if(!readDataEntry(keyword, val))
387 "cannot find dataEntry "<< keyword <<
" in dictionary "<< globalName()<<
endl;
400 return max(getVal<T>(keyword), maxVal);
410 return min(getVal<T>(keyword), minVal);
421 if( readDataEntry(keyword, val) )
443 template <
typename T>
451 return addPtr(keyword, ptr,
false);
457 #endif // __dictionary_hpp__
List< iEntry * > orderedEntries_
entries in order of insertion
T getValOrSet(const word &keyword, const T &setVal) const
get the value of data entry or if not found, set the value to setVal
#define fatalExit
Fatal exit.
word name_
global name of dictionary, separated with dots
virtual iTstream & stream()
access to token stream
bool read(iIstream &is) override
read from stream
wordList allKeywords() const
return all keywords (non-nullptr) in this dictionary
iEntry * findEntry(const word &keyword)
find an entry based on keyword return nullptr if not found
const dictionary & parDict_
ref to parrent dictionary
dictionary & operator=(const dictionary &rhs)
assignment preserve name of this dictionary only entries are transfered with ownership
T max(const internalField< T, MemorySpace > &iField)
bool addOrKeep(const word &keyword, const T &v)
virtual word globalName() const
global name of entry, separated with dots
dictionary & subDictOrCreate(const word &keyword)
search for a sub-dict with keyword create a new sub-dict if not found and return a ref to it fatalExi...
bool add(const word &keyword, const float &v)
add a float dataEntry
virtual const word & keyword() const
return keyword
virtual bool isDictionary() const
if this is a dictionary
iOstream & endl(iOstream &os)
Add newline and flush stream.
static dictionary nullDict
virtual iEntry * clonePtr() const
clone the object
bool containsDataEntry(const word &name) const
check if a data entry exist
wordList dictionaryKeywords() const
return a list of all dictionary (non-null) keywords
virtual dictionary * dictPtr()
pointer to this dictionary
wordOrderedMapPtr< iEntry > entries_
all the entries (data and dictionary) of the current dictionary
Manages file pathes, manupulate and combines them.
bool containsDictionay(const word &name) const
check if a sub-dictionary exists
T getValMin(const word &keyword, const T &minVal) const
get the value of data entry and return min(value, minVal)
Data entry to be used in dictionries.
T getValMax(const word &keyword, const T &maxVal) const
get the value of data entry and return max(value, maxVal)
size_t numEntries() const
return number of entris in this dictionary
Interface class for any input stream
virtual uniquePtr< iEntry > clone() const
clone polymorphic object (here dictionary)
dataEntry * dataEntryPtr(const word &keyword)
pointer to a dataEntry fatalExit if not found/not a dataEntry
#define fatalErrorInFunction
Report a fatal error and function name and exit the application.
virtual bool isFileDict() const
if dictionary is file dictionary, return false
virtual dictionary & dict()
ref to this dictionary, if it is a dictionary
bool readDictionary(iIstream &is)
read dictionary from stream - without keyword
bool writeDictionary(iOstream &os, bool withBlock=true) const
write dictionary to stream - with keyword
size_t numDataEntries() const
return number of non-nullptr dataEntries
dataEntry & dataEntryRef(const word &keyword)
ref to a subdictioanry fatalExit if not found/not a dataEntry
bool write(iOstream &os) const override
write to stream
T min(const internalField< T, MemorySpace > &iField)
dictionary * subDictPtr(const word &keyword)
pointer to a subdictionary fatalExit if not found
bool readDataEntry(const word &keyword, T &val) const
reads a dataEntry with keyword from dictionary
dictionary & subDict(const word &keyword)
ref to a subdictioanry fatalExit if not found
virtual word name() const
name/keyword of entry
T getVal(const word &keyword) const
get the value of data entry
bool addPtr(const word &keyword, uniquePtr< iEntry > &etry, bool warning=true)
add a pointer entry (dictionary/dataEntry) replaces this entry with existing one and issue a warning
bool addOrReplace(const word &keyword, const T &v)
T getValOrSetMin(const word &keyword, const T &setMinVal) const
get the value of data entry anf return max(setMinVal, value) if not found, set the value to setMinVal
unsigned long long int uint64
Interface calss for data entry and dictionary
dictionary()
cunstructs a null dictionary
bool addDict(const word &keyword, const dictionary &dict)
add a dictionary with the specifiedd keyword, if it exists, replace it.
size_t numDictionaries() const
return number of non-nullptr dictionaries
T getValOrSetMax(const word &keyword, const T &setMaxVal) const
get the value of data entry anf return max(setMaxVal, value) if not found, set the value to setMaxVal
virtual const dictionary & parrentDict() const
const ref to parrent dictionary
Interface class for any output stream.
wordList dataEntryKeywords() const
return a list of all dataEntries (non-nullptr) keywords
Dictionary holds a set of data entries or sub-dictionaries that are enclosed in a curely braces or ar...