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
72public:
73 //# Enumerations
74 // Operations
141
142 // Operation category
144 // Unary, binary 1 or 2 character
146 // Special and functions
148 // Number
150 // Special categories
153 // Save environment while compiling
155 // Indicate a GOTO
157 // Final expression codes
159 // Special priority levels
161 // Lowest priority at which right-to-left rather than left-to-right
162 // execution
163 RTLPRI = 44,
164 // Priority for specials - start
165 SPCPRI = 60,
166 // Priority for finals
167 FINPRI = 00 };
168
169 // The compilation state descriptor
171 // Old index of low RPS boundary
173 // # of values available on value stack
175 // Argument count
177 // Previous saved program counter
179 };
180 // The operator description: code; priority; # of arguments; # of arguments
181 // used up (or produced for functions)
183 // The operator code
185 // The name (or characters)
187 // The category
189 // Execution priority
191 // # of arguments necessary (or minimum)
193 // max # of arguments (for function)
195 // # of results produced/used
197 // code info (like par/x index; jump distance
199 // special action
201 // state
203 };
204
205 //# Constructors
206 // Construct the data for the expression analysis
208
209 // Destructor
211
212 //# Member functions
213 // Accessors of the various maps
214 // <group>
215 map<String, ExprOperator> &unary2() { return una2_p; }
216 const map<String, ExprOperator> &unary2() const { return una2_p; }
217 map<String, ExprOperator> &unary1() { return una1_p; }
218 const map<String, ExprOperator> &unary1() const { return una1_p; }
219 map<String, ExprOperator> &binary2() { return bin2_p; }
220 const map<String, ExprOperator> &binary2() const { return bin2_p; }
221 map<String, ExprOperator> &binary1() { return bin1_p; }
222 const map<String, ExprOperator> &binary1() const { return bin1_p; }
223 map<String, ExprOperator> &special() { return spop_p; }
224 const map<String, ExprOperator> &special() const { return spop_p; }
225 map<String, ExprOperator> &function() { return func_p; }
226 const map<String, ExprOperator> &function() const { return func_p; }
227 // </group>
228 // Print an operator map
229 void print(ostream &os,
230 const map<String, FuncExprData::ExprOperator> &m) const;
231 // Print an operation
232 void print(ostream &os, const FuncExprData::ExprOperator &pos) const;
233
234private:
235 //# Data
236 // Unary operators of 2 characters
237 map<String, ExprOperator> una2_p;
238 // Unary operators of 1 character
239 map<String, ExprOperator> una1_p;
240 // Binary operators of 2 characters
241 map<String, ExprOperator> bin2_p;
242 // Binary operators of 1 character
243 map<String, ExprOperator> bin1_p;
244 // Special operators
245 map<String, ExprOperator> spop_p;
246 // Function names
247 map<String, ExprOperator> func_p;
248 // All operators
249 map<opTypes, ExprOperator> allop_p;
250};
251
252//# Global Functions
253
254// <summary> Output function </summary>
255
256// <group name=output>
257// Show a list of all defined operators and functions
258ostream &operator<<(ostream &os, const FuncExprData &ed);
259// </group>
260
261
262} //# NAMESPACE CASACORE - END
263
264#endif
265
266
267
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:223
this file contains all the compiler specific defines
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.