codeBlockStreamEntry.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::codeBlockStreamEntry
26 
27 Description
28 
29 See also
30  Foam::functionEntries::codeIncludeEntry
31  Foam::functionEntries::codeStream
32 
33 SourceFiles
34  codeBlockStreamEntry.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef codeBlockStreamEntry_H
39 #define codeBlockStreamEntry_H
40 
41 #include "functionEntry.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 namespace functionEntries
48 {
49 
50 class codeBlockEntry;
51 
52 /*---------------------------------------------------------------------------*\
53  Class codeBlockStreamEntry Declaration
54 \*---------------------------------------------------------------------------*/
55 
57 :
58  public functionEntry
59 {
60  //- Pointer to the codeBlockEntry
61  // which created this codeBlockStreamEntry
62  const codeBlockEntry* codeBlockPtr_;
63 
64  //- Index of the function in the codeBlock
65  // corresponding to this codeBlockStreamEntry
66  label index_;
67 
68 
69  // Private Member Functions
70 
71  //- Perform the calculation and return the resulting string
72  OTstream resultStream(const dictionary& dict, Istream& is);
73 
74 
75 public:
76 
77  //- Runtime type information
78  FunctionTypeName("#codeBlockStream");
79 
80 
81  // Constructors
82 
83  //- Construct from line number, dictionary and Istream
85  (
86  const label lineNumber,
87  const dictionary& parentDict,
88  Istream& is
89  );
90 
91  //- Copy construct
93 
94  //- Clone
95  virtual autoPtr<entry> clone(const dictionary&) const
96  {
97  return autoPtr<entry>(new codeBlockStreamEntry(*this));
98  }
99 
100 
101  // Member Functions
102 
103  //- Expand the functionEntry into the contextDict
104  virtual bool execute(dictionary& contextDict, Istream&);
105 
106  //- Expand the functionEntry into the contextEntry
107  static bool execute
108  (
109  const dictionary& contextDict,
110  primitiveEntry& contextEntry,
111  Istream&
112  );
113 
114  //- Dummy write
115  virtual void write(Ostream&) const;
116 
117 
118  // Member Operators
119 
120  //- Disallow default bitwise assignment
121  void operator=(const codeBlockStreamEntry&) = delete;
122 };
123 
124 
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 
127 } // End namespace functionEntries
128 } // End namespace Foam
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 #endif
133 
134 // ************************************************************************* //
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
Output token stream.
Definition: OTstream.H:56
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
Part of the #codeBlock...#codeBlock clause.
codeBlockStreamEntry(const label lineNumber, const dictionary &parentDict, Istream &is)
Construct from line number, dictionary and Istream.
virtual void write(Ostream &) const
Dummy write.
FunctionTypeName("#codeBlockStream")
Runtime type information.
virtual bool execute(dictionary &contextDict, Istream &)
Expand the functionEntry into the contextDict.
void operator=(const codeBlockStreamEntry &)=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 keyword and a list of tokens is a 'primitiveEntry'. An primitiveEntry can be read,...
const dictionary & dict() const
This entry is not a dictionary,.
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