calcEntry.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 | Copyright (C) 2011-2013 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::calcEntry
26 
27 Description
28  Uses dynamic compilation to provide calculating functionality
29  for entering dictionary entries.
30 
31  E.g.
32 
33  \verbatim
34  a 1.0;
35  b 3;
36  c #calc "$a/$b";
37  \endverbatim
38 
39  Note the explicit trailing 0 ('1.0') to force a to be read (and written)
40  as a floating point number.
41 
42 Note
43  Internally this is just a wrapper around codeStream functionality - the
44  #calc string gets used to construct a dictionary for codeStream.
45 
46 SourceFiles
47  calcEntry.C
48 
49 \*---------------------------------------------------------------------------*/
50 
51 #ifndef calcEntry_H
52 #define calcEntry_H
53 
54 #include "functionEntry.H"
55 
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 
58 namespace Foam
59 {
60 class dlLibraryTable;
61 
62 namespace functionEntries
63 {
64 
65 /*---------------------------------------------------------------------------*\
66  Class calcEntry Declaration
67 \*---------------------------------------------------------------------------*/
68 
69 class calcEntry
70 :
71  public functionEntry
72 {
73 
74  // Private Member Functions
75 
76  //- Disallow default bitwise copy construct
77  calcEntry(const calcEntry&);
78 
79  //- Disallow default bitwise assignment
80  void operator=(const calcEntry&);
81 
82 
83 public:
84 
85  //- Runtime type information
86  ClassName("calc");
87 
88 
89  // Member Functions
90 
91  //- Execute the functionEntry in a sub-dict context
92  static bool execute(dictionary& parentDict, Istream&);
93 
94  //- Execute the functionEntry in a primitiveEntry context
95  static bool execute
96  (
97  const dictionary& parentDict,
99  Istream&
100  );
101 
102 };
103 
104 
105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
106 
107 } // End namespace functionEntries
108 } // End namespace Foam
109 
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111 
112 #endif
113 
114 // ************************************************************************* //
Uses dynamic compilation to provide calculating functionality for entering dictionary entries...
Definition: calcEntry.H:68
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Namespace for OpenFOAM.
static bool execute(dictionary &parentDict, Istream &)
Execute the functionEntry in a sub-dict context.
Definition: calcEntry.C:108
A functionEntry causes entries to be added/manipulated on the specified dictionary given an input str...
Definition: functionEntry.H:63
ClassName("calc")
Runtime type information.
A keyword and a list of tokens is a &#39;primitiveEntry&#39;. An primitiveEntry can be read, written and printed, and the types and values of its tokens analysed.