Encapsulation of dynamic code dictionaries. More...
#include <dynamicCodeContext.H>
Public Member Functions | |
| dynamicCodeContext () | |
| Default construct. | |
| dynamicCodeContext (const dictionary &dict) | |
| Construct from a dictionary. | |
| bool | good () const noexcept |
| Not using dummy code context (dictionary::null). | |
| bool | valid () const noexcept |
| Same as good(). | |
| void | setCodeContext (const dictionary &dict) |
| Set code context from a dictionary. | |
| const dictionary & | dict () const noexcept |
| Return the parent dictionary context. | |
| const string & | options () const noexcept |
| The code options (Make/options). | |
| const string & | libs () const noexcept |
| The code libs (LIB_LIBS). | |
| const string & | include () const noexcept |
| The code includes. | |
| const string & | localCode () const noexcept |
| The local (file-scope) code. | |
| const string & | code () const noexcept |
| The code. | |
| const SHA1 & | sha1 () const noexcept |
| The SHA1 calculated from options, libs, include, code, etc. | |
| void | append (const std::string &str) |
| Add content to SHA1 hashing. | |
| const entry * | findEntry (const word &key) const |
| Locate literal dictionary entry, nullptr if not found. | |
| 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. | |
| 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. | |
| operator const dictionary & () const noexcept | |
| Cast to dictionary. | |
Static Public Member Functions | |
| static void | inplaceExpand (string &str, const dictionary &dict) |
| Cleanup string and expand with dictionary parameters. | |
| static unsigned | addLineDirective (string &code, label lineNum, const string &file) |
| Prefix a #line directive to code. | |
| static unsigned | addLineDirective (string &code, label lineNum, const dictionary &dict) |
| Prefix a #line directive to code. | |
Encapsulation of dynamic code dictionaries.
Definition at line 49 of file dynamicCodeContext.H.
| dynamicCodeContext | ( | ) |
Default construct.
Definition at line 73 of file dynamicCodeContext.C.
Referenced by dynamicCodeContext().

|
explicit |
Construct from a dictionary.
Definition at line 79 of file dynamicCodeContext.C.
References dict(), dynamicCodeContext(), and setCodeContext().

|
static |
Cleanup string and expand with dictionary parameters.
Definition at line 27 of file dynamicCodeContext.C.
References dict(), Foam::stringOps::inplaceExpand(), and Foam::stringOps::inplaceTrim().
Referenced by 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 38 of file dynamicCodeContext.C.
References code(), and Foam::name().
Referenced by addLineDirective(), and readEntry().


|
static |
Prefix a #line directive to code.
The name of the dictionary is used for the 'file' name.
Definition at line 60 of file dynamicCodeContext.C.
References addLineDirective(), code(), and dict().

|
noexcept |
Not using dummy code context (dictionary::null).
Definition at line 89 of file dynamicCodeContext.C.
References Foam::noexcept, and dictionary::null.
Referenced by valid().

|
inlinenoexcept |
Same as good().
Definition at line 151 of file dynamicCodeContext.H.
References good(), and Foam::noexcept.

| void setCodeContext | ( | const dictionary & | dict | ) |
Set code context from a dictionary.
Definition at line 156 of file dynamicCodeContext.C.
References dict(), and readIfPresent().
Referenced by dynamicCodeContext().


|
inlinenoexcept |
Return the parent dictionary context.
Definition at line 161 of file dynamicCodeContext.H.
References Foam::noexcept.
Referenced by addLineDirective(), dynamicCodeContext(), codeStream::getFunction(), inplaceExpand(), readEntry(), setCodeContext(), and codedBase::updateLibrary().

|
inlinenoexcept |
The code options (Make/options).
Definition at line 169 of file dynamicCodeContext.H.
References Foam::noexcept.
Referenced by codeStream::getFunction(), codedMixedFvPatchField< Type >::prepare(), codedPoints0MotionSolver::prepare(), CodedFunction1< Type >::prepare(), codedFunctionObject::prepare(), CodedSource< Type >::prepare(), and CodedField< Type >::prepare().

|
inlinenoexcept |
The code libs (LIB_LIBS).
Definition at line 177 of file dynamicCodeContext.H.
References Foam::noexcept.
Referenced by codeStream::getFunction(), codedMixedFvPatchField< Type >::prepare(), codedPoints0MotionSolver::prepare(), CodedFunction1< Type >::prepare(), codedFunctionObject::prepare(), CodedSource< Type >::prepare(), and CodedField< Type >::prepare().

|
inlinenoexcept |
The code includes.
Definition at line 185 of file dynamicCodeContext.H.
References Foam::noexcept.
Referenced by dynamicCode::setFilterContext().

|
inlinenoexcept |
The local (file-scope) code.
Definition at line 193 of file dynamicCodeContext.H.
References Foam::noexcept.
Referenced by dynamicCode::setFilterContext().

|
inlinenoexcept |
The code.
Definition at line 201 of file dynamicCodeContext.H.
References Foam::noexcept.
Referenced by addLineDirective(), addLineDirective(), CodedFunction1< Type >::prepare(), CodedField< Type >::prepare(), and dynamicCode::setFilterContext().

|
inlinenoexcept |
The SHA1 calculated from options, libs, include, code, etc.
Definition at line 209 of file dynamicCodeContext.H.
References Foam::noexcept.
Referenced by codeStream::getFunction(), codedMixedFvPatchField< Type >::prepare(), codedPoints0MotionSolver::prepare(), CodedFunction1< Type >::prepare(), codedFunctionObject::prepare(), CodedSource< Type >::prepare(), CodedField< Type >::prepare(), dynamicCode::setFilterContext(), codedBase::updateLibrary(), and dynamicCode::upToDate().

|
inline |
Add content to SHA1 hashing.
Definition at line 217 of file dynamicCodeContext.H.
| const Foam::entry * findEntry | ( | const word & | key | ) | const |
Locate literal dictionary entry, nullptr if not found.
Definition at line 95 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 101 of file dynamicCodeContext.C.
References addLineDirective(), dict, dict(), Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, inplaceExpand(), keyType::LITERAL, Foam::nl, entry::readEntry(), and entry::startLineNumber().
Referenced by readIfPresent().


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 145 of file dynamicCodeContext.C.
References readEntry().

|
inlinenoexcept |
Cast to dictionary.
Definition at line 265 of file dynamicCodeContext.H.