dynamicCode: Put code entries on a list

The dynamic code functionality has been generalised so that the names of
the code entries in the specifying dictionary can be set by the caller.
This means that functions which utilise dynamic code but use different
entry names (e.g., codedFunctionObject uses codeExecute, codeEnd,
etc..., instead of code) now function correctly. The differently named
entries now form part of the library hash, and re-building triggers
appropriately as they are modified.
This commit is contained in:
Will Bainbridge
2019-01-31 15:00:57 +00:00
parent 0497d2a170
commit 700f11fa11
19 changed files with 298 additions and 415 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -90,6 +90,12 @@ class codedFunctionObject
{
protected:
// Protected static data
//- The keywords associated with source code
static const wordList codeKeys_;
// Protected data
//- Reference to the time database
@ -98,14 +104,9 @@ protected:
//- Input dictionary
dictionary dict_;
//- The name
word name_;
string codeData_;
string codeRead_;
string codeExecute_;
string codeWrite_;
string codeEnd_;
//- Underlying functionObject
mutable autoPtr<functionObject> redirectFunctionObjectPtr_;
@ -118,15 +119,18 @@ protected:
//- Adapt the context for the current object
virtual void prepare(dynamicCode&, const dynamicCodeContext&) const;
// Return a description (type + name) for the output
//- Return a description (type + name) for the output
virtual string description() const;
// Clear any redirected objects
//- Clear any redirected objects
virtual void clearRedirect() const;
// Get the dictionary to initialize the codeContext
//- Get the dictionary to initialize the codeContext
virtual const dictionary& codeDict() const;
//- Get the keywords associated with source code
virtual const wordList& codeKeys() const;
private: