dynamicCodeContext Class Reference

Encapsulation of dynamic code dictionaries. More...

Public Member Functions

 dynamicCodeContext ()
 Construct null. More...
 
 dynamicCodeContext (const dictionary &dict)
 Construct from a dictionary. More...
 
bool valid () const
 Considered valid if not using dictionary::null as the context. More...
 
void setCodeContext (const dictionary &dict)
 Set code context from a dictionary. More...
 
const dictionarydict () const
 Return the parent dictionary context. More...
 
const stringinclude () const
 Return the code-includes. More...
 
const stringoptions () const
 Return the code-options. More...
 
const stringlibs () const
 Return the code-libs. More...
 
const stringcode () const
 Return the code. More...
 
const stringlocalCode () const
 Return the local (file-scope) code. More...
 
const SHA1sha1 () const
 Return SHA1 calculated from options, libs, include, code. More...
 
void append (const std::string &str)
 Add content to SHA1 hashing. More...
 
 operator const dictionary & () const
 Cast to dictionary. More...
 

Static Public Member Functions

static void inplaceExpand (string &code, const dictionary &dict)
 Cleanup string and expand with dictionary parameters. More...
 
static unsigned addLineDirective (string &code, label lineNum, const fileName &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...
 

Detailed Description

Encapsulation of dynamic code dictionaries.

Source files

Definition at line 53 of file dynamicCodeContext.H.

Constructor & Destructor Documentation

◆ dynamicCodeContext() [1/2]

Construct null.

Definition at line 81 of file dynamicCodeContext.C.

◆ dynamicCodeContext() [2/2]

dynamicCodeContext ( const dictionary dict)
explicit

Construct from a dictionary.

Definition at line 87 of file dynamicCodeContext.C.

References dynamicCodeContext::dict(), and dynamicCodeContext::setCodeContext().

Here is the call graph for this function:

Member Function Documentation

◆ inplaceExpand()

void inplaceExpand ( string code,
const dictionary dict 
)
static

Cleanup string and expand with dictionary parameters.

Definition at line 36 of file dynamicCodeContext.C.

References dict, Foam::stringOps::inplaceExpand(), and Foam::stringOps::inplaceTrim().

Referenced by codedFunctionObject::read(), and dynamicCodeContext::setCodeContext().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addLineDirective() [1/2]

unsigned addLineDirective ( string code,
label  lineNum,
const fileName file 
)
static

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)

Returns
The change in string length caused by the directive. This can potentially be used to recover the substring portions.

Definition at line 47 of file dynamicCodeContext.C.

References Foam::name().

Referenced by codedFunctionObject::read().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addLineDirective() [2/2]

unsigned addLineDirective ( string code,
label  lineNum,
const dictionary dict 
)
static

Prefix a #line directive to code.

The name of the dictionary is used for the 'file' name.

Definition at line 69 of file dynamicCodeContext.C.

References dict.

◆ valid()

bool valid ( ) const

Considered valid if not using dictionary::null as the context.

Definition at line 97 of file dynamicCodeContext.C.

References dictionary::null.

◆ setCodeContext()

void setCodeContext ( const dictionary dict)

Set code context from a dictionary.

Definition at line 103 of file dynamicCodeContext.C.

References dict, dictionary::findEntry(), dynamicCodeContext::inplaceExpand(), keyType::LITERAL, entry::readEntry(), and entry::startLineNumber().

Referenced by dynamicCodeContext::dynamicCodeContext().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dict()

const dictionary& dict ( ) const
inline

Return the parent dictionary context.

Definition at line 128 of file dynamicCodeContext.H.

References dictionary::get().

Referenced by dynamicCodeContext::dynamicCodeContext(), codeStream::getFunction(), and codedBase::updateLibrary().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ include()

const string& include ( ) const
inline

Return the code-includes.

Definition at line 134 of file dynamicCodeContext.H.

Referenced by dynamicCode::setFilterContext().

Here is the caller graph for this function:

◆ options()

const string& options ( ) const
inline

Return the code-options.

Definition at line 140 of file dynamicCodeContext.H.

Referenced by codeStream::getFunction(), CodedField< Type >::prepare(), codedPoints0MotionSolver::prepare(), codedMixedFvPatchField< Type >::prepare(), CodedSource< Type >::prepare(), and codedFunctionObject::prepare().

Here is the caller graph for this function:

◆ libs()

const string& libs ( ) const
inline

Return the code-libs.

Definition at line 146 of file dynamicCodeContext.H.

Referenced by codeStream::getFunction(), CodedField< Type >::prepare(), codedPoints0MotionSolver::prepare(), codedMixedFvPatchField< Type >::prepare(), CodedSource< Type >::prepare(), and codedFunctionObject::prepare().

Here is the caller graph for this function:

◆ code()

const string& code ( ) const
inline

Return the code.

Definition at line 152 of file dynamicCodeContext.H.

Referenced by CodedField< Type >::prepare(), and dynamicCode::setFilterContext().

Here is the caller graph for this function:

◆ localCode()

const string& localCode ( ) const
inline

Return the local (file-scope) code.

Definition at line 158 of file dynamicCodeContext.H.

Referenced by dynamicCode::setFilterContext().

Here is the caller graph for this function:

◆ sha1()

const SHA1& sha1 ( ) const
inline

Return SHA1 calculated from options, libs, include, code.

Definition at line 164 of file dynamicCodeContext.H.

Referenced by codeStream::getFunction(), dynamicCode::setFilterContext(), codedBase::updateLibrary(), and dynamicCode::upToDate().

Here is the caller graph for this function:

◆ append()

void append ( const std::string &  str)
inline

Add content to SHA1 hashing.

Definition at line 170 of file dynamicCodeContext.H.

References SHA1::append().

Here is the call graph for this function:

◆ operator const dictionary &()

operator const dictionary & ( ) const
inline

Cast to dictionary.

Definition at line 179 of file dynamicCodeContext.H.

References dictionary::get().

Here is the call graph for this function:

The documentation for this class was generated from the following files: