Encapsulation of dynamic code dictionaries. More...
Public Member Functions | |
dynamicCodeContext () | |
Default construct. More... | |
dynamicCodeContext (const dictionary &dict) | |
Construct from a dictionary. More... | |
bool | valid () const noexcept |
Considered valid if not using dictionary::null as the context. More... | |
void | setCodeContext (const dictionary &dict) |
Set code context from a dictionary. More... | |
const dictionary & | dict () const noexcept |
Return the parent dictionary context. More... | |
const string & | options () const noexcept |
The code options (Make/options) More... | |
const string & | libs () const noexcept |
The code libs (LIB_LIBS) More... | |
const string & | include () const noexcept |
The code includes. More... | |
const string & | localCode () const noexcept |
The local (file-scope) code. More... | |
const string & | code () const noexcept |
The code. More... | |
const SHA1 & | sha1 () const noexcept |
The SHA1 calculated from options, libs, include, code, etc. More... | |
void | append (const std::string &str) |
Add content to SHA1 hashing. More... | |
const entry * | findEntry (const word &key) const |
Locate literal dictionary entry, nullptr if not found. More... | |
bool | readEntry (const word &key, string &str, bool mandatory=true, bool withLineNum=true) |
Read string entry from context dictionary append content to SHA1 hashing and add line number etc. More... | |
bool | readIfPresent (const word &key, string &str, bool withLineNum=true) |
Read optional string entry from context dictionary, append content to SHA1 hashing and add line number etc. More... | |
operator const dictionary & () const noexcept | |
Cast to dictionary. More... | |
Static Public Member Functions | |
static void | inplaceExpand (string &str, const dictionary &dict) |
Cleanup string and expand with dictionary parameters. More... | |
static unsigned | addLineDirective (string &code, label lineNum, const string &file) |
Prefix a #line directive to code. More... | |
static unsigned | addLineDirective (string &code, label lineNum, const dictionary &dict) |
Prefix a #line directive to code. More... | |
Encapsulation of dynamic code dictionaries.
Definition at line 49 of file dynamicCodeContext.H.
Default construct.
Definition at line 74 of file dynamicCodeContext.C.
|
explicit |
Construct from a dictionary.
Definition at line 80 of file dynamicCodeContext.C.
References dynamicCodeContext::dict(), and dynamicCodeContext::setCodeContext().
|
static |
Cleanup string and expand with dictionary parameters.
Definition at line 29 of file dynamicCodeContext.C.
References dict, Foam::stringOps::inplaceExpand(), and Foam::stringOps::inplaceTrim().
Referenced by dynamicCodeContext::readEntry().
Prefix a #line directive to code.
The input lineNum is 0-based. Is a no-op if any of the arguments are invalid (lineNum is negative, code or file are empty)
Definition at line 40 of file dynamicCodeContext.C.
References Foam::name().
|
static |
Prefix a #line directive to code.
The name of the dictionary is used for the 'file' name.
Definition at line 62 of file dynamicCodeContext.C.
References dict.
|
noexcept |
Considered valid if not using dictionary::null as the context.
Definition at line 90 of file dynamicCodeContext.C.
References dictionary::null.
void setCodeContext | ( | const dictionary & | dict | ) |
Set code context from a dictionary.
Definition at line 157 of file dynamicCodeContext.C.
References dict, and readIfPresent().
Referenced by dynamicCodeContext::dynamicCodeContext().
|
inlinenoexcept |
Return the parent dictionary context.
Definition at line 156 of file dynamicCodeContext.H.
Referenced by dynamicCodeContext::dynamicCodeContext(), codeStream::getFunction(), and codedBase::updateLibrary().
|
inlinenoexcept |
The code options (Make/options)
Definition at line 164 of file dynamicCodeContext.H.
Referenced by codeStream::getFunction(), codedPoints0MotionSolver::prepare(), CodedField< Type >::prepare(), CodedFunction1< Type >::prepare(), codedFunctionObject::prepare(), CodedSource< Type >::prepare(), and codedMixedFvPatchField< Type >::prepare().
|
inlinenoexcept |
The code libs (LIB_LIBS)
Definition at line 172 of file dynamicCodeContext.H.
Referenced by codeStream::getFunction(), codedPoints0MotionSolver::prepare(), CodedField< Type >::prepare(), CodedFunction1< Type >::prepare(), codedFunctionObject::prepare(), CodedSource< Type >::prepare(), and codedMixedFvPatchField< Type >::prepare().
|
inlinenoexcept |
The code includes.
Definition at line 180 of file dynamicCodeContext.H.
Referenced by dynamicCode::setFilterContext().
|
inlinenoexcept |
The local (file-scope) code.
Definition at line 188 of file dynamicCodeContext.H.
Referenced by dynamicCode::setFilterContext().
|
inlinenoexcept |
The code.
Definition at line 196 of file dynamicCodeContext.H.
Referenced by CodedField< Type >::prepare(), CodedFunction1< Type >::prepare(), and dynamicCode::setFilterContext().
|
inlinenoexcept |
The SHA1 calculated from options, libs, include, code, etc.
Definition at line 204 of file dynamicCodeContext.H.
Referenced by codeStream::getFunction(), codedPoints0MotionSolver::prepare(), CodedField< Type >::prepare(), CodedFunction1< Type >::prepare(), codedFunctionObject::prepare(), CodedSource< Type >::prepare(), codedMixedFvPatchField< Type >::prepare(), dynamicCode::setFilterContext(), codedBase::updateLibrary(), and dynamicCode::upToDate().
|
inline |
Add content to SHA1 hashing.
Definition at line 212 of file dynamicCodeContext.H.
References SHA1::append().
const Foam::entry * findEntry | ( | const word & | key | ) | const |
Locate literal dictionary entry, nullptr if not found.
Definition at line 96 of file dynamicCodeContext.C.
References dict, dictionary::findEntry(), and keyType::LITERAL.
Read string entry from context dictionary append content to SHA1 hashing and add line number etc.
The string is cleared before reading.
Definition at line 103 of file dynamicCodeContext.C.
References dict, Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, dictionary::findEntry(), dynamicCodeContext::inplaceExpand(), Foam::glTF::key(), keyType::LITERAL, dictionary::name(), Foam::nl, entry::readEntry(), and entry::startLineNumber().
Read optional string entry from context dictionary, append content to SHA1 hashing and add line number etc.
The string is cleared before reading.
Definition at line 147 of file dynamicCodeContext.C.
References Foam::glTF::key().
|
inlinenoexcept |
Cast to dictionary.
Definition at line 260 of file dynamicCodeContext.H.
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.