Base class for function objects and boundary conditions using dynamic code that provides methods for managing loading/unloading/updating of a dynamic library. For these purposes, it uses a dynamicCodeContext object to maintain information about the state. More...
Public Member Functions | |
ClassName ("codedBase") | |
Runtime type information. More... | |
codedBase ()=default | |
Default construct. More... | |
virtual | ~codedBase ()=default |
Destructor. More... | |
Protected Member Functions | |
dynamicCodeContext & | codeContext () |
Access to the dynamic code context. More... | |
void | setCodeContext (const dictionary &dict) |
Set code context from a dictionary. More... | |
void | append (const std::string &str) |
Add content to SHA1 hashing. More... | |
void | updateLibrary (const word &name, const dynamicCodeContext &context) const |
Update library as required, using the given context. More... | |
void | updateLibrary (const word &name, const dictionary &dict) const |
void | updateLibrary (const word &name) const |
virtual dlLibraryTable & | libs () const =0 |
Mutable access to the loaded dynamic libraries. More... | |
virtual string | description () const =0 |
virtual void | clearRedirect () const =0 |
virtual const dictionary & | codeDict () const =0 |
virtual void | prepare (dynamicCode &dynCode, const dynamicCodeContext &context) const =0 |
Adapt the context for the current object. More... | |
codedBase (const codedBase &)=delete | |
No copy construct. More... | |
void | operator= (const codedBase &)=delete |
No copy assignment. More... | |
Static Protected Member Functions | |
static void | writeCodeDict (Ostream &os, const dictionary &dict) |
Write code-dictionary contents. More... | |
static const dictionary & | codeDict (const objectRegistry &obr, const word &dictName="codeDict") |
Return "codeDict" from objectRegistry or read from disk. More... | |
Base class for function objects and boundary conditions using dynamic code that provides methods for managing loading/unloading/updating of a dynamic library. For these purposes, it uses a dynamicCodeContext object to maintain information about the state.
For simple coded objects, the default state management is sufficient. When there are more complicated code segments (eg, functionObjects::codedFunctionObject), the state management must also register these elements as well, starting with an initial setCodeContext() call and followed by append() to register each element.
Definition at line 66 of file codedBase.H.
|
default |
Default construct.
|
virtualdefault |
Destructor.
|
staticprotected |
Write code-dictionary contents.
Definition at line 88 of file codedBase.C.
References dict, os(), and Foam::writeEntryIfPresent().
Referenced by codedFixedValueFvPatchField< Type >::write(), codedMixedFvPatchField< Type >::write(), and codedFixedValuePointPatchField< Type >::write().
|
staticprotected |
Return "codeDict" from objectRegistry or read from disk.
Definition at line 100 of file codedBase.C.
References dictName(), objectRegistry::getObjectPtr(), IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE, regIOobject::store(), TimePaths::system(), and objectRegistry::time().
|
inlineprotected |
Access to the dynamic code context.
Definition at line 119 of file codedBase.H.
Referenced by codedFunctionObject::read(), and CodedSource< Type >::read().
|
protected |
Set code context from a dictionary.
Definition at line 341 of file codedBase.C.
References dict.
Referenced by CodedField< Type >::CodedField(), CodedFunction1< Type >::CodedFunction1(), codedFunctionObject::read(), and CodedSource< Type >::read().
|
protected |
Add content to SHA1 hashing.
Definition at line 347 of file codedBase.C.
|
protected |
Update library as required, using the given context.
Definition at line 353 of file codedBase.C.
References dlLibraryTable::basename(), dynamicCode::checkSecurity(), dynamicCode::codeName(), DetailInfo, dynamicCodeContext::dict(), Foam::endl(), dynamicCode::libPath(), dictionary::name(), Foam::name(), dynamicCodeContext::sha1(), dictionary::startLineNumber(), and SHA1::str().
Referenced by CodedField< Type >::CodedField(), CodedFunction1< Type >::CodedFunction1(), and codedFunctionObject::codedFunctionObject().
|
protected |
Update library as required, using the given code dictionary to use for the context
Definition at line 412 of file codedBase.C.
References dict, and Foam::name().
|
protected |
Update library as required, using the predefined context or use the codeDict() to generate one
Definition at line 422 of file codedBase.C.
References Foam::name().
|
protectedpure virtual |
Mutable access to the loaded dynamic libraries.
Implemented in codedPoints0MotionSolver, codedMixedFvPatchField< Type >, codedFunctionObject, CodedSource< Type >, CodedField< Type >, and CodedFunction1< Type >.
|
protectedpure virtual |
|
protectedpure virtual |
|
protectedpure virtual |
|
protectedpure virtual |
Adapt the context for the current object.
Implemented in codedPoints0MotionSolver, codedMixedFvPatchField< Type >, codedFunctionObject, CodedSource< Type >, CodedField< Type >, and CodedFunction1< Type >.
|
protecteddelete |
No copy assignment.
ClassName | ( | "codedBase" | ) |
Runtime type information.