exprResultStack.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2012-2018 Bernhard Gschaider <bgschaid@hfd-research.com>
9 Copyright (C) 2019-2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::expressions::exprResultStack
29
30Description
31 A stack of polymorphic fields.
32 Can be used to build a list of results one at a time.
33
34SourceFiles
35 exprResultStack.C
36 exprResultStackTemplates.C
37
38\*---------------------------------------------------------------------------*/
39
40#ifndef expressions_exprResultStack_H
41#define expressions_exprResultStack_H
42
43#include "exprResult.H"
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
49namespace expressions
50{
51
52/*---------------------------------------------------------------------------*\
53 Class exprResultStack Declaration
54\*---------------------------------------------------------------------------*/
57:
59{
60 // Private Data
61
62 //- Type-checked pop value.
63 // \return True if the type check was satisfied
64 template<class T>
65 bool popChecked(exprResult& result);
66
67 //- Type-checked push value.
68 // \return True if the type check was satisfied
69 template<class T>
70 bool pushChecked(const exprResult& result);
71
72
73public:
74
75 //- Runtime type information
76 TypeName("exprResultStack");
77
78
79 // Constructors
80
81 //- Default construct
83
84 //- Copy construct
86
87 //- Construct from a dictionary
88 explicit exprResultStack(const dictionary& dict);
89
90
91 // Selectors
93 virtual autoPtr<exprResult> clone() const
94 {
96 (
97 new exprResultStack(*this)
98 );
99 }
100
101
102 //- Destructor
103 virtual ~exprResultStack() = default;
104
105
106 // Member Functions
107
108 //- Pop the last value as an expression result
109 exprResult pop();
110
111 //- Push an expression result value
112 void push(const exprResult& result);
113
114
115 // Member Operators
116
117 //- Copy assignment
118 void operator=(const exprResultStack& rhs);
119
120 //- Copy assignment
121 void operator=(const exprResult& rhs);
122};
123
124
125// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126
127} // End namespace expressions
128} // End namespace Foam
129
130// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131
132#ifdef NoRepository
134#endif
135
136// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137
138#endif
139
140// ************************************************************************* //
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A stack of polymorphic fields. Can be used to build a list of results one at a time.
exprResult pop()
Pop the last value as an expression result.
virtual ~exprResultStack()=default
Destructor.
TypeName("exprResultStack")
Runtime type information.
void operator=(const exprResultStack &rhs)
Copy assignment.
virtual autoPtr< exprResult > clone() const
Clone.
void push(const exprResult &result)
Push an expression result value.
A polymorphic field/result from evaluating an expression.
Definition: exprResult.H:127
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73