casacore
Loading...
Searching...
No Matches
FuncExprData.h
Go to the documentation of this file.
1// # FuncExprData.h: Data and enumerations for functional expressions
2// # Copyright (C) 2001,2002
3// # Associated Universities, Inc. Washington DC, USA.
4// #
5// # This library is free software; you can redistribute it and/or modify it
6// # under the terms of the GNU Library General Public License as published by
7// # the Free Software Foundation; either version 2 of the License, or (at your
8// # option) any later version.
9// #
10// # This library is distributed in the hope that it will be useful, but WITHOUT
11// # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12// # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13// # License for more details.
14// #
15// # You should have received a copy of the GNU Library General Public License
16// # along with this library; if not, write to the Free Software Foundation,
17// # Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18// #
19// # Correspondence concerning AIPS++ should be addressed as follows:
20// # Internet email: casa-feedback@nrao.edu.
21// # Postal address: AIPS++ Project Office
22// # National Radio Astronomy Observatory
23// # 520 Edgemont Road
24// # Charlottesville, VA 22903-2475 USA
25
26#ifndef SCIMATH_FUNCEXPRDATA_H
27#define SCIMATH_FUNCEXPRDATA_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/BasicSL/String.h>
32#include <casacore/casa/stdmap.h>
33
34// # Forward Declarations
35#include <casacore/casa/iosfwd.h>
36
37namespace casacore { // # NAMESPACE CASACORE - BEGIN
38
39// <summary> Data and enumerations for functional expressions
40// </summary>
41
42// <use visibility=local>
43
44// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
45// </reviewed>
46
47// <prerequisite>
48// <li> <linkto class=Function>Function</linkto> class
49// </prerequisite>
50//
51// <synopsis>
52// This class provides enumerations for expression analysis; and data element
53// descriptions
54// </synopsis>
55//
56// <example>
57// </example>
58//
59// <motivation>
60// To tie the Glish language to non-linear fitting procedures
61// </motivation>
62//
63// <thrown>
64// <li>
65// </thrown>
66//
67// <todo asof="2001/11/21">
68// <li> nothing directly
69// </todo>
70
72 public:
73 // # Enumerations
74 // Operations
142
143 // Operation category
145 // Unary, binary 1 or 2 character
150 // Special and functions
153 // Number
155 };
156 // Special categories
159 // Save environment while compiling
161 // Indicate a GOTO
163 // Final expression codes
165 };
166 // Special priority levels
168 // Lowest priority at which right-to-left rather than left-to-right
169 // execution
170 RTLPRI = 44,
171 // Priority for specials - start
172 SPCPRI = 60,
173 // Priority for finals
175 };
176
177 // The compilation state descriptor
179 // Old index of low RPS boundary
181 // # of values available on value stack
183 // Argument count
185 // Previous saved program counter
187 };
188 // The operator description: code; priority; # of arguments; # of arguments
189 // used up (or produced for functions)
191 // The operator code
193 // The name (or characters)
195 // The category
197 // Execution priority
199 // # of arguments necessary (or minimum)
201 // max # of arguments (for function)
203 // # of results produced/used
205 // code info (like par/x index; jump distance
207 // special action
209 // state
211 };
212
213 // # Constructors
214 // Construct the data for the expression analysis
216
217 // Destructor
219
220 // # Member functions
221 // Accessors of the various maps
222 // <group>
224 const map<String, ExprOperator> &unary2() const { return una2_p; }
226 const map<String, ExprOperator> &unary1() const { return una1_p; }
228 const map<String, ExprOperator> &binary2() const { return bin2_p; }
230 const map<String, ExprOperator> &binary1() const { return bin1_p; }
232 const map<String, ExprOperator> &special() const { return spop_p; }
234 const map<String, ExprOperator> &function() const { return func_p; }
235 // </group>
236 // Print an operator map
237 void print(ostream &os, const map<String, FuncExprData::ExprOperator> &m) const;
238 // Print an operation
239 void print(ostream &os, const FuncExprData::ExprOperator &pos) const;
240
241 private:
242 // # Data
243 // Unary operators of 2 characters
245 // Unary operators of 1 character
247 // Binary operators of 2 characters
249 // Binary operators of 1 character
251 // Special operators
253 // Function names
255 // All operators
257};
258
259// # Global Functions
260
261// <summary> Output function </summary>
262
263// <group name=output>
264// Show a list of all defined operators and functions
265ostream &operator<<(ostream &os, const FuncExprData &ed);
266// </group>
267
268} // namespace casacore
269
270#endif
map< String, ExprOperator > spop_p
Special operators.
map< opTypes, ExprOperator > allop_p
All operators.
const map< String, ExprOperator > & function() const
specPriority
Special priority levels.
@ FINPRI
Priority for finals.
@ SPCPRI
Priority for specials - start.
@ RTLPRI
Lowest priority at which right-to-left rather than left-to-right execution.
void print(ostream &os, const FuncExprData::ExprOperator &pos) const
Print an operation.
const map< String, ExprOperator > & special() const
map< String, ExprOperator > func_p
Function names.
specAction
Special categories.
@ SAVENV
Save environment while compiling.
@ FINAL
Final expression codes.
@ GOTOPC
Indicate a GOTO.
map< String, ExprOperator > bin1_p
Binary operators of 1 character.
map< String, ExprOperator > bin2_p
Binary operators of 2 characters.
map< String, ExprOperator > & binary1()
map< String, ExprOperator > & binary2()
map< String, ExprOperator > una1_p
Unary operators of 1 character.
map< String, ExprOperator > & unary2()
Accessors of the various maps.
const map< String, ExprOperator > & binary2() const
const map< String, ExprOperator > & unary2() const
const map< String, ExprOperator > & binary1() const
opCategories
Operation category.
@ SPEC
Special and functions.
@ UNA2
Unary, binary 1 or 2 character.
map< String, ExprOperator > & function()
const map< String, ExprOperator > & unary1() const
map< String, ExprOperator > una2_p
Unary operators of 2 characters.
map< String, ExprOperator > & unary1()
void print(ostream &os, const map< String, FuncExprData::ExprOperator > &m) const
Print an operator map.
FuncExprData()
Construct the data for the expression analysis.
~FuncExprData()
Destructor.
map< String, ExprOperator > & special()
String: the storage and methods of handling collections of characters.
Definition String.h:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
ostream & operator<<(ostream &os, const IComplex &)
Show on ostream.
unsigned int uInt
Definition aipstype.h:49
int Int
Definition aipstype.h:48
The compilation state descriptor.
uInt pcptr
Previous saved program counter.
uInt rpslow
Old index of low RPS boundary.
The operator description: code; priority; # of arguments; # of arguments used up (or produced for fun...
uInt nmaxarg
max # of arguments (for function)
specAction special
special action
Int info
code info (like par/x index; jump distance
opTypes code
The operator code.
String name
The name (or characters).
opCategories category
The category.
uInt priority
Execution priority.
ostream & operator<<(ostream &os, const FuncExprData &ed)
Show a list of all defined operators and functions.