Go to the documentation of this file.
46 Foam::expressions::exprResultGlobals::singleton_;
51 Foam::expressions::exprResultGlobals::exprResultGlobals
53 const objectRegistry& obr
64 IOobject::READ_IF_PRESENT,
90 for (
auto iter = tbl.cbegin(); iter != tbl.cend(); ++iter)
92 this->
set(iter.key(), (*iter)->clone());
111 void Foam::expressions::exprResultGlobals::reset()
177 return variables_[
name];
188 for (
const word& scopeName : scopes)
190 const auto tableIter = variables_.find(scopeName);
192 if (tableIter.found())
194 const auto resultIter = (*tableIter).find(
name);
196 if (resultIter.found())
198 return *(*resultIter);
205 <<
"No scope " << scopeName <<
" for " <<
name <<
nl
206 <<
"Known global scopes: " << variables_.sortedToc() <<
nl;
224 Table& tbl = getOrCreateScope(scope);
226 auto iter = tbl.find(
name);
231 iter = tbl.find(
name);
251 Table& tbl = getOrCreateScope(scope);
253 if (overwrite || !tbl.found(
name))
271 Table& tbl = getOrCreateScope(scope);
273 if (overwrite || !tbl.found(
name))
290 word scopeName(scope);
294 if (scopeName.empty())
296 scopeName =
dict.get<
word>(
"globalScope");
299 if (
dict.found(
"resultType"))
328 auto iter = variables_.find(scope);
330 return (iter.found() && (*iter).erase(
name));
virtual bool writeData(Ostream &os) const
Write variables.
const word & name() const
Return name.
A class for handling words, derived from Foam::string.
const Time & time() const
Return time.
streamFormat format() const noexcept
Get the current stream format.
const exprResult & get(const word &name, const wordUList &scopes) const
Return a global variable, if it exists, or a exprResult::null.
Table & getNamespace(const word &name)
Get an existing table for the namespace.
Registry of regIOobjects.
static const exprResult null
An empty result.
bool set(const word &key, exprResult *ptr)
Assign a new entry, overwriting existing entries.
A polymorphic field/result from evaluating an expression.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
static autoPtr< exprResult > New(const dictionary &dict)
Return a reference to the selected value driver.
A globally available registry of expression results.
#define forAllIters(container, iter)
Iterate across all elements in the container object.
virtual bool readData(Istream &os)
Read variables.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
bool removeValue(const word &name, const word &scope)
Remove named result from specified scope.
bool bad() const
Return true if stream is corrupted.
exprResult & addValue(const word &name, const word &scope, const exprResult &value, const bool overwrite=true)
Add named result to specified scope.
A HashTable of pointers to objects of type <T>.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Istream & readStream(const word &, const bool valid=true)
Return Istream and check object type against that given.
label timeIndex() const
Return current time index.
bool good() const
Return true if next operation might succeed.
defineTypeNameAndDebug(fvExprDriver, 0)
static exprResultGlobals & New(const objectRegistry &obr)
Get the singleton.
#define WarningInFunction
Report a warning using Foam::Warning.
bool headerOk()
Read and check header info.