Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes
codedBase Class Referenceabstract

Base class for function objects and boundary conditions using dynamic code. More...

Inheritance diagram for codedBase:
Inheritance graph
[legend]
Collaboration diagram for codedBase:
Collaboration graph
[legend]

Public Member Functions

 ClassName ("codedBase")
 Runtime type information. More...
 
 codedBase ()
 Construct null. More...
 
virtual ~codedBase ()
 Destructor. More...
 

Protected Member Functions

void updateLibrary (const word &redirectType) const
 Update library as required. More...
 
virtual dlLibraryTablelibs () const =0
 Get the loaded dynamic libraries. More...
 
virtual void prepare (dynamicCode &, const dynamicCodeContext &) const =0
 Adapt the context for the current object. More...
 
virtual string description () const =0
 
virtual void clearRedirect () const =0
 
virtual const dictionarycodeDict () const =0
 

Private Types

typedef void(* loaderFunctionType) (bool)
 Global loader/unloader function type. More...
 

Private Member Functions

void * loadLibrary (const fileName &libPath, const string &globalFuncName, const dictionary &contextDict) const
 Load specified library and execute globalFuncName(true) More...
 
void unloadLibrary (const fileName &libPath, const string &globalFuncName, const dictionary &contextDict) const
 Execute globalFuncName(false) and unload specified library. More...
 
void createLibrary (dynamicCode &, const dynamicCodeContext &) const
 Create library based on the dynamicCodeContext. More...
 
 codedBase (const codedBase &)
 Disallow default bitwise copy construct. More...
 
void operator= (const codedBase &)
 Disallow default bitwise assignment. More...
 

Private Attributes

fileName oldLibPath_
 Previously loaded library. More...
 

Detailed Description

Base class for function objects and boundary conditions using dynamic code.

Source files

Definition at line 53 of file codedBase.H.

Member Typedef Documentation

◆ loaderFunctionType

typedef void(* loaderFunctionType(bool)
private

Global loader/unloader function type.

Definition at line 63 of file codedBase.H.

Constructor & Destructor Documentation

◆ codedBase() [1/2]

codedBase ( const codedBase )
private

Disallow default bitwise copy construct.

◆ codedBase() [2/2]

codedBase ( )

Construct null.

Definition at line 343 of file codedBase.C.

◆ ~codedBase()

~codedBase ( )
virtual

Destructor.

Definition at line 349 of file codedBase.C.

Member Function Documentation

◆ loadLibrary()

void * loadLibrary ( const fileName libPath,
const string globalFuncName,
const dictionary contextDict 
) const
private

Load specified library and execute globalFuncName(true)

Definition at line 46 of file codedBase.C.

References Foam::dlSym(), Foam::dlSymFound(), Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, and Foam::nl.

Here is the call graph for this function:

◆ unloadLibrary()

void unloadLibrary ( const fileName libPath,
const string globalFuncName,
const dictionary contextDict 
) const
private

Execute globalFuncName(false) and unload specified library.

Definition at line 114 of file codedBase.C.

References Foam::dlSym(), Foam::dlSymFound(), Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, and Foam::nl.

Here is the call graph for this function:

◆ createLibrary()

void createLibrary ( dynamicCode dynCode,
const dynamicCodeContext context 
) const
private

Create library based on the dynamicCodeContext.

Since the library has only been compiled on the master the

other nodes need to pick this library up through NFS We do this by just polling a few times using the fileModificationSkew.

Definition at line 171 of file codedBase.C.

References dynamicCode::copyOrCreateFiles(), dynamicCodeContext::dict(), Foam::endl(), Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, Foam::fileSize(), dynamicCode::libPath(), dynamicCode::libRelPath(), Foam::nl, Foam::Pout, Foam::reduce(), dynamicCode::reset(), Foam::sleep(), dynamicCode::upToDate(), and dynamicCode::wmakeLibso().

Here is the call graph for this function:

◆ operator=()

void operator= ( const codedBase )
private

Disallow default bitwise assignment.

◆ updateLibrary()

void updateLibrary ( const word redirectType) const
protected

Update library as required.

Definition at line 282 of file codedBase.C.

References dynamicCode::codeName(), dict, dynamicCodeContext::dict(), Foam::endl(), Foam::Info, dynamicCode::libPath(), dynamicCodeContext::sha1(), and SHA1Digest::str().

Here is the call graph for this function:

◆ libs()

virtual dlLibraryTable& libs ( ) const
protectedpure virtual

◆ prepare()

virtual void prepare ( dynamicCode ,
const dynamicCodeContext  
) const
protectedpure virtual

◆ description()

virtual string description ( ) const
protectedpure virtual

◆ clearRedirect()

virtual void clearRedirect ( ) const
protectedpure virtual

◆ codeDict()

virtual const dictionary& codeDict ( ) const
protectedpure virtual

◆ ClassName()

ClassName ( "codedBase"  )

Runtime type information.

Field Documentation

◆ oldLibPath_

fileName oldLibPath_
mutableprivate

Previously loaded library.

Definition at line 58 of file codedBase.H.


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