33 template<
class ... Entries>
36 const Entries& ... entries
39 return std::tuple<
const Entries& ...>(
entries ...);
45 template<
class ... Entries,
size_t ... Indices>
46 void Foam::dictionary::set
48 const std::tuple<const Entries& ...>& entries,
49 const std::integer_sequence<size_t, Indices ...>&
52 set(std::get<Indices>(entries) ...);
56 template<
class ... Entries>
57 void Foam::dictionary::set
59 const std::tuple<const Entries& ...>& entries
62 set(entries, std::make_integer_sequence<
size_t,
sizeof ... (Entries)>());
68 template<
class ... Entries>
77 template<
class ... Entries>
81 const std::tuple<const Entries& ...>& entries
90 template<
class ... Entries>
95 const std::tuple<const Entries& ...>& entries
104 template<
class ... Entries>
108 const std::tuple<const Entries& ...>& entries
127 const entry* entryPtr = lookupEntryPtr(keyword, recursive, patternMatch);
129 if (entryPtr ==
nullptr)
132 <<
"keyword " << keyword <<
" is undefined in dictionary "
136 return Foam::readAndMaybeConvert<T>(entryPtr->
stream());
140 template<
class T,
class DefaultUnits>
144 const DefaultUnits& defaultUnits,
149 const entry* entryPtr = lookupEntryPtr(keyword, recursive, patternMatch);
151 if (entryPtr ==
nullptr)
154 <<
"keyword " << keyword <<
" is undefined in dictionary "
158 return Foam::readAndConvert<T>(entryPtr->
stream(), defaultUnits);
170 const entry* entryPtr =
171 lookupEntryPtrBackwardsCompatible(keywords, recursive, patternMatch);
175 return Foam::readAndMaybeConvert<T>(entryPtr->
stream());
180 return lookup<T>(keywords[0], recursive, patternMatch);
185 template<
class T,
class DefaultUnits>
189 const DefaultUnits& defaultUnits,
194 const entry* entryPtr =
195 lookupEntryPtrBackwardsCompatible(keywords, recursive, patternMatch);
199 return Foam::readAndConvert<T>(entryPtr->
stream(), defaultUnits);
204 return lookup<T>(keywords[0], recursive, patternMatch);
213 const T& defaultValue
216 const entry* entryPtr = lookupEntryPtr(keyword,
false,
false);
220 return Foam::readAndMaybeConvert<T>(entryPtr->
stream());
224 if (haveDefaults(*
this))
238 template<
class T,
class DefaultUnits>
242 const DefaultUnits& defaultUnits,
243 const T& defaultValue
246 const entry* entryPtr = lookupEntryPtr(keyword,
false,
false);
250 return Foam::readAndConvert<T>(entryPtr->
stream(), defaultUnits);
254 if (haveDefaults(*
this))
272 const T& defaultValue
275 const entry* entryPtr =
276 lookupEntryPtrBackwardsCompatible(keywords,
false,
false);
280 return Foam::readAndMaybeConvert<T>(entryPtr->
stream());
285 return lookupOrDefault<T>(keywords[0], defaultValue);
290 template<
class T,
class DefaultUnits>
294 const DefaultUnits& defaultUnits,
295 const T& defaultValue
298 const entry* entryPtr =
299 lookupEntryPtrBackwardsCompatible(keywords,
false,
false);
303 return Foam::readAndConvert<T>(entryPtr->
stream(), defaultUnits);
308 return lookupOrDefault<T>(keywords[0], defaultValue);
317 const T& defaultValue
320 const entry* entryPtr = lookupEntryPtr(keyword,
false,
false);
324 return Foam::readAndMaybeConvert<T>(entryPtr->
stream());
328 if (haveDefaults(*
this))
352 const entry* entryPtr = lookupEntryPtr(keyword, recursive, patternMatch);
356 val = Foam::readAndMaybeConvert<T>(entryPtr->
stream());
366 template<
class T,
class DefaultUnits>
370 const DefaultUnits& defaultUnits,
376 const entry* entryPtr = lookupEntryPtr(keyword, recursive, patternMatch);
380 val = Foam::readAndConvert<T>(entryPtr->
stream(), defaultUnits);
398 const entry* entryPtr =
399 lookupScopedEntryPtr(keyword, recursive, patternMatch);
401 if (entryPtr ==
nullptr)
404 <<
"keyword " << keyword <<
" is undefined in dictionary "
420 const entry* entryPtr =
421 lookupScopedEntryPtr(keyword, recursive, patternMatch);
423 if (entryPtr ==
nullptr)
428 ) <<
"keyword " << keyword <<
" is undefined in dictionary "
435 return dynamicCast<const token::Compound<T>>(firstToken.
compoundToken());
447 void Foam::dictionary::set(
const keyType&
k,
const T& t)
453 template<
class ... Entries>
454 void Foam::dictionary::set
457 const std::tuple<const Entries& ...>& entries
464 template<
class ... Entries>
465 void Foam::dictionary::set(
const entry&
e,
const Entries& ... entries)
472 template<
class T,
class ... Entries>
473 void Foam::dictionary::set
477 const Entries& ... entries
487 template<
class EntryType>
491 const word& entryName,
492 const EntryType& value
501 template<
class EntryType,
class DefaultUnits>
505 const word& entryName,
506 const DefaultUnits& defaultUnits,
507 const EntryType& value
516 template<
class EntryType>
520 const word& entryName,
521 const EntryType& value1,
522 const EntryType& value2
525 if (value1 != value2)
532 template<
class EntryType,
class DefaultUnits>
536 const word& entryName,
537 const DefaultUnits& defaultUnits,
538 const EntryType& value1,
539 const EntryType& value2
542 if (value1 != value2)
544 writeEntry(os, entryName, defaultUnits, value2);
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A keyword and a list of tokens is a 'dictionaryEntry'.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
T lookupOrDefault(const word &, const T &) const
Find and return a T, if not found return the given default.
dictionary()
Construct top-level dictionary null.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
T lookupOrAddDefault(const word &, const T &)
Find and return a T, if not found return the given.
T lookupOrDefaultBackwardsCompatible(const wordList &, const T &) const
Find and return a T, trying a list of keywords in sequence,.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
ITstream & lookupBackwardsCompatible(const wordList &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream, trying a list of keywords.
const T & lookupCompoundScoped(const word &keyword, bool recursive, bool patternMatch) const
Find return the reference to the compound T,.
static std::tuple< const Entries &... > entries(const Entries &...)
Construct an entries tuple from which to make a dictionary.
T lookupScoped(const word &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
A keyword and a list of tokens is an 'entry'.
virtual ITstream & stream() const =0
Return token stream if this entry is a primitive entry.
A class for handling file names.
A class for handling keywords in dictionaries.
Traits class for primitives.
A keyword and a list of tokens is a 'primitiveEntry'. An primitiveEntry can be read,...
A token holds items read from Istream.
const compound & compoundToken() const
A class for handling words, derived from string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void writeEntryIfDifferent(Ostream &os, const word &entryName, const EntryType &value1, const EntryType &value2)
Helper function to write the keyword and entry only if the.
void add(GeometricField< typename typeOfSum< Type1, Type2 >::type, GeoMesh, PrimitiveField1 > &gf, const GeometricField< Type1, GeoMesh, PrimitiveField2 > &gf1, const GeometricField< Type2, GeoMesh, PrimitiveField3 > &gf2)
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
Ostream & writeKeyword(Foam::Ostream &os, const keyType &kw)
Write the keyword to the Ostream with the current level of indentation.
void T(GeometricField< Type, GeoMesh, PrimitiveField1 > &gf, const GeometricField< Type, GeoMesh, PrimitiveField2 > &gf1)
void writeEntry(Ostream &os, const word &key, const DimensionedFieldFunction< DimensionedFieldType > &f)