codeBlockDictEntry.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) 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::codeBlockDictEntry
26 
27 Description
28 
29 See also
30  Foam::functionEntries::codeBlockStream
31 
32 SourceFiles
33  codeBlockDictEntry.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef codeBlockDictEntry_H
38 #define codeBlockDictEntry_H
39 
40 #include "functionEntry.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 namespace functionEntries
47 {
48 
49 class codeBlockEntry;
50 
51 /*---------------------------------------------------------------------------*\
52  Class codeBlockDictEntry Declaration
53 \*---------------------------------------------------------------------------*/
54 
56 :
57  public functionEntry
58 {
59  //- Pointer to the codeBlockEntry which created this codeBlockDictEntry
60  const codeBlockEntry* codeBlockPtr_;
61 
62  //- Index of the function in the codeBlock
63  // corresponding to this codeBlockDictEntry
64  label index_;
65 
66 
67  // Private Member Functions
68 
69  //- Compile and execute the code to manipulate the contextDict
70  bool resultStream(dictionary& contextDict, Istream& is);
71 
72 
73 public:
74 
75  //- Runtime type information
76  FunctionTypeName("#codeBlockDict");
77 
78 
79  // Constructors
80 
81  //- Construct from line number, dictionary and Istream
83  (
84  const label lineNumber,
85  const dictionary& parentDict,
86  Istream& is
87  );
88 
89  //- Copy construct
90  codeBlockDictEntry(const codeBlockDictEntry&) = default;
91 
92  //- Clone
93  virtual autoPtr<entry> clone(const dictionary&) const
94  {
95  return autoPtr<entry>(new codeBlockDictEntry(*this));
96  }
97 
98 
99  // Member Functions
100 
101  //- Expand the functionEntry into the contextDict
102  virtual bool execute(dictionary& contextDict, Istream&);
103 
104  //- Dummy write
105  virtual void write(Ostream&) const;
106 
107 
108  // Member Operators
109 
110  //- Disallow default bitwise assignment
111  void operator=(const codeBlockDictEntry&) = delete;
112 };
113 
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 
117 } // End namespace functionEntries
118 } // End namespace Foam
119 
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 
122 #endif
123 
124 // ************************************************************************* //
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 Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
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
codeBlockDictEntry(const label lineNumber, const dictionary &parentDict, Istream &is)
Construct from line number, dictionary and Istream.
virtual void write(Ostream &) const
Dummy write.
FunctionTypeName("#codeBlockDict")
Runtime type information.
virtual bool execute(dictionary &contextDict, Istream &)
Expand the functionEntry into the contextDict.
void operator=(const codeBlockDictEntry &)=delete
Disallow default bitwise assignment.
Part of the #codeBlock...#codeBlock clause.
A functionEntry causes entries to be added/manipulated on the specified dictionary given an input str...
Definition: functionEntry.H:66
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