1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
28 Base class for function objects and boundary conditions using dynamic code
33 \*---------------------------------------------------------------------------*/
38 #include "dictionary.H"
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 // Forward declaration of classes
47 class dynamicCodeContext;
50 /*---------------------------------------------------------------------------*\
51 Class codedBase Declaration
52 \*---------------------------------------------------------------------------*/
58 //- Previously loaded library
59 mutable fileName oldLibPath_;
61 // Private Member Functions
63 //- Global loader/unloader function type
64 typedef void (*loaderFunctionType)(bool);
66 //- Load specified library and execute globalFuncName(true)
69 const fileName& libPath,
70 const string& globalFuncName,
71 const dictionary& contextDict
74 //- Execute globalFuncName(false) and unload specified library
77 const fileName& libPath,
78 const string& globalFuncName,
79 const dictionary& contextDict
82 //- Create library based on the dynamicCodeContext
83 void createLibrary(dynamicCode&, const dynamicCodeContext&) const;
85 //- Disallow default bitwise copy construct
86 codedBase(const codedBase&);
88 //- Disallow default bitwise assignment
89 void operator=(const codedBase&);
94 //- Update library as required
97 const word& redirectType
100 //- get the loaded dynamic libraries
101 virtual dlLibraryTable& libs() const = 0;
103 //- adapt the context for the current object
107 const dynamicCodeContext &
110 // Return a description (type + name) for the output
111 virtual string description() const = 0;
113 // Clear any redirected objects
114 virtual void clearRedirect() const = 0;
116 // Get the dictionary to initialize the codeContext
117 virtual const dictionary& codeDict() const = 0;
129 virtual ~codedBase();
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 } // End namespace Foam
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 // ************************************************************************* //