47 Foam::expressions::exprResultGlobals::exprResultGlobals
49 const objectRegistry& obr
56 exprResultGlobals::typeName,
60 IOobject::READ_IF_PRESENT,
82 for (
auto iter = tbl.cbegin(); iter != tbl.cend(); ++iter)
84 this->
set(iter.key(), (*iter)->clone());
103 void Foam::expressions::exprResultGlobals::reset()
192 return variables_[
name];
203 for (
const word& scopeName : scopes)
205 const auto tableIter = variables_.cfind(scopeName);
207 if (tableIter.good())
209 const auto resultIter = (*tableIter).cfind(
name);
211 if (resultIter.good())
213 return *(*resultIter);
220 <<
"No scope " << scopeName <<
" for " <<
name <<
nl 221 <<
"Known global scopes: " << variables_.sortedToc() <<
nl;
239 Table& tbl = getOrCreateScope(scope);
241 auto iter = tbl.find(
name);
246 iter = tbl.find(
name);
266 Table& tbl = getOrCreateScope(scope);
268 if (overwrite || !tbl.found(
name))
270 tbl.set(
name, std::move(value));
285 word scopeName(scope);
289 if (scopeName.empty())
291 scopeName =
dict.get<
word>(
"globalScope");
294 if (
dict.found(
"resultType"))
310 exprResult(
dict,
true),
323 auto iter = variables_.find(scope);
325 return (iter.good() && iter.val().erase(
name));
bool bad() const noexcept
True if stream is corrupted.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Table & getNamespace(const word &name)
Get an existing table for the namespace.
A polymorphic field/result from evaluating an expression.
const word & name() const noexcept
Return the object name.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
constexpr char nl
The newline '\n' character (0x0a)
A globally available registry of expression results. These are currently registered on Time (may chan...
bool headerOk()
Read and check header info. Does not check the headerClassName.
virtual bool writeData(Ostream &os) const
Write variables.
bool checkOut(regIOobject *io) const
Remove a regIOobject from registry and free memory if the object is ownedByRegistry. A nullptr is ignored.
A HashTable of pointers to objects of type <T>, with deallocation management of the pointers...
const exprResult & get(const word &name, const wordUList &scopes) const
Return a global variable, if it exists, or a exprResult::null.
Table()=default
Default construct.
defineTypeName(fvExprDriverWriter)
static autoPtr< exprResult > New(const dictionary &dict)
Return a reference to the selected value driver.
A class for handling words, derived from Foam::string.
Type * getObjectPtr(const word &name, const bool recursive=false) const
Return non-const pointer to the object of the given Type, using a const-cast to have it behave like a...
const Time & time() const noexcept
Return time registry.
static bool Delete(const objectRegistry &obr)
Static destructor for singleton.
#define forAllIters(container, iter)
Iterate across all elements in the container object.
exprResult & addValue(const word &name, const word &scope, const exprResult &value, const bool overwrite=true)
Add named result to specified scope.
label timeIndex() const noexcept
Return the current time index.
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...
virtual bool readData(Istream &os)
Read variables.
bool removeValue(const word &name, const word &scope)
Remove named result from specified scope.
OBJstream os(runTime.globalPath()/outputName)
#define WarningInFunction
Report a warning using Foam::Warning.
static const exprResult null
An empty result.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Registry of regIOobjects.
streamFormat format() const noexcept
Get the current stream format.
Istream & readStream(const word &, const bool readOnProc=true)
Return Istream and check object type against that given.
static exprResultGlobals & New(const objectRegistry &obr)
Static constructor for singleton.