codeBlockEntry.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2025-2026 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 Class
25  Foam::functionEntries::codeBlockEntry
26 
27 Description
28  Part of the #codeBlock...#codeBlock clause
29 
30 SourceFiles
31  codeBlockEntry.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef codeBlockEntry_H
36 #define codeBlockEntry_H
37 
38 #include "functionEntry.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 namespace functionEntries
45 {
46 
47 // Forward declaration of friend classes
48 class codeBlockStreamEntry;
49 class codeBlockDictEntry;
50 
51 /*---------------------------------------------------------------------------*\
52  Class codeBlockEntry Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 class codeBlockEntry
56 :
57  public functionEntry
58 {
59  // Private Data
60 
61  //- Unique name of the code block
62  // containing the #calc and #codeStream functions
63  word codeBlockName_;
64 
65  //- Pointer to the compiled library
66  // containing the #calc and #codeStream functions
67  void* lib_;
68 
69  //- Name of the code options file to be used
70  static const word codeOptions;
71 
72  //- Name of the C code template to be used
73  static const wordList compileFiles;
74 
75 
76 public:
77 
78  // Related types
79 
80  //- Declare friendship with the codeBlock classes
81  friend class codeBlockStreamEntry;
82  friend class codeBlockDictEntry;
83 
84 
85  //- Runtime type information
86  FunctionTypeName("#codeBlock");
87 
88 
89  // Constructors
90 
91  //- Construct from line number, dictionary and Istream
93  (
94  const label lineNumber,
95  const dictionary& parentDict,
96  Istream& is
97  );
98 
99  //- Copy construct
100  codeBlockEntry(const codeBlockEntry&) = default;
101 
102  //- Clone
103  virtual autoPtr<entry> clone(const dictionary&) const
104  {
105  return autoPtr<entry>(new codeBlockEntry(*this));
106  }
107 
108 
109  // Member Functions
110 
111  //- Expand the functionEntry into the contextDict
112  virtual bool execute(dictionary& contextDict, Istream& is);
113 
114 
115  // Member Operators
116 
117  //- Disallow default bitwise assignment
118  void operator=(const codeBlockEntry&) = delete;
119 };
120 
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 } // End namespace functionEntries
125 } // End namespace Foam
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 #endif
130 
131 // ************************************************************************* //
label lineNumber() const
Return current stream line number.
Definition: IOstream.H:450
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
virtual autoPtr< entry > clone() const
Construct on freestore as copy.
Definition: entry.C:56
Part of the #codeBlock...#codeBlock clause.
virtual bool execute(dictionary &contextDict, Istream &is)
Expand the functionEntry into the contextDict.
FunctionTypeName("#codeBlock")
Runtime type information.
codeBlockEntry(const label lineNumber, const dictionary &parentDict, Istream &is)
Construct from line number, dictionary and Istream.
void operator=(const codeBlockEntry &)=delete
Disallow default bitwise assignment.
A functionEntry causes entries to be added/manipulated on the specified dictionary given an input str...
Definition: functionEntry.H:66
A class for handling words, derived from string.
Definition: word.H:63
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59