casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSFieldParse.h
Go to the documentation of this file.
1 //# MSFieldParse.h: Classes to hold results from field grammar parser
2 //# Copyright (C) 1994,1995,1997,1998,1999,2000,2001,2003
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: aips2-request@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 //# $Id$
27 
28 #ifndef MS_MSFIELDPARSE_H
29 #define MS_MSFIELDPARSE_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
38 namespace casacore { //# NAMESPACE CASACORE - BEGIN
39 
40 //# Forward Declarations
41 
42 
43 // <motivation>
44 // It is necessary to be able to give a ms command in ASCII.
45 // This can be used in a CLI or in the table browser to get a subset
46 // of a table or to sort a table.
47 // </motivation>
48 
49 // <summary>
50 // Class to hold values from field grammar parser
51 // </summary>
52 
53 // <use visibility=local>
54 
55 // <reviewed reviewer="" date="" tests="">
56 // </reviewed>
57 
58 // <prerequisite>
59 //# Classes you should understand before using this one.
60 // </prerequisite>
61 
62 // <etymology>
63 // MSFieldParse is the class used to parse a field command.
64 // </etymology>
65 
66 // <synopsis>
67 // MSFieldParse is used by the parser of field sub-expression statements.
68 // The parser is written in Bison and Flex in files MSFieldGram.y and .l.
69 // The statements in there use the routines in this file to act
70 // upon a reduced rule.
71 // Since multiple tables can be given (with a shorthand), the table
72 // names are stored in a list. The variable names can be qualified
73 // by the table name and will be looked up in the appropriate table.
74 //
75 // The class MSFieldParse only contains information about a table
76 // used in the table command. Global variables (like a list and a vector)
77 // are used in MSFieldParse.cc to hold further information.
78 //
79 // Global functions are used to operate on the information.
80 // The main function is the global function msFieldCommand.
81 // It executes the given STaQL command and returns the resulting ms.
82 // This is, in fact, the only function to be used by a user.
83 // </synopsis>
84 
85  class MSFieldParse : public MSParse
86  {
87 
88  public:
89  // Default constructor
90  MSFieldParse ();
92  MSFieldParse (const MSField& fieldSubTable, const TableExprNode& columnAsTEN);
94 
95  const TableExprNode *selectFieldIds(const Vector<Int>& fieldIds);
96 
97  // Get table expression node object.
98  static const TableExprNode* node();
100  static Vector<Int> selectedIDs() {return idList;}
101  static void reset();
102  static void cleanup()
103  {if (node_p) delete node_p;node_p=0x0;}
105  private:
111  };
112 
113 } //# NAMESPACE CASACORE - END
114 
115 #endif
116 
117 
118 //---------------------OLD CODE START (Feb. 2012)-------------------
119 // #ifndef MS_MSFIELDPARSE_H
120 // #define MS_MSFIELDPARSE_H
121 
122 // //# Includes
123 // #include <casacore/ms/MSSel/MSParse.h>
124 // #include <casacore/ms/MSSel/MSSelectionError.h>
125 // #include <casacore/ms/MSSel/MSSelectableTable.h>
126 // namespace casacore { //# NAMESPACE CASACORE - BEGIN
127 
128 // //# Forward Declarations
129 
130 
131 // // <summary>
132 // // Class to hold values from field grammar parser
133 // // </summary>
134 
135 // // <use visibility=local>
136 
137 // // <reviewed reviewer="" date="" tests="">
138 // // </reviewed>
139 
140 // // <prerequisite>
141 // //# Classes you should understand before using this one.
142 // // </prerequisite>
143 
144 // // <etymology>
145 // // MSFieldParse is the class used to parse a field command.
146 // // </etymology>
147 
148 // // <synopsis>
149 // // MSFieldParse is used by the parser of field sub-expression statements.
150 // // The parser is written in Bison and Flex in files MSFieldGram.y and .l.
151 // // The statements in there use the routines in this file to act
152 // // upon a reduced rule.
153 // // Since multiple tables can be given (with a shorthand), the table
154 // // names are stored in a list. The variable names can be qualified
155 // // by the table name and will be looked up in the appropriate table.
156 // //
157 // // The class MSFieldParse only contains information about a table
158 // // used in the table command. Global variables (like a list and a vector)
159 // // are used in MSFieldParse.cc to hold further information.
160 // //
161 // // Global functions are used to operate on the information.
162 // // The main function is the global function msFieldCommand.
163 // // It executes the given STaQL command and returns the resulting ms.
164 // // This is, in fact, the only function to be used by a user.
165 // // </synopsis>
166 
167 // // <motivation>
168 // // It is necessary to be able to give a ms command in ASCII.
169 // // This can be used in a CLI or in the table browser to get a subset
170 // // of a table or to sort a table.
171 // // </motivation>
172 
173 // //# <todo asof="$DATE:$">
174 // //# A List of bugs, limitations, extensions or planned refinements.
175 // //# </todo>
176 
177 
178 // class MSFieldParse : public MSParse
179 // {
180 
181 // public:
182 // // Default constructor
183 // MSFieldParse ();
184 // // ~MSFieldParse() {idList.resize(0);}
185 // // Associate the ms and the shorthand.
186 // MSFieldParse (const MeasurementSet* ms);
187 // MSFieldParse (MSSelectableTable* msLike);
188 // //~MSFieldParse() {if (node_p) delete node_p;node_p=0x0;}
189 
190 // const TableExprNode *selectFieldIds(const Vector<Int>& fieldIds);
191 // // const TableExprNode *selectFieldOrSource(const String& fieldName);
192 
193 // // Get table expression node object.
194 // static const TableExprNode* node();
195 // static MSFieldParse* thisMSFParser;
196 // static Vector<Int> selectedIDs() {return idList;}
197 // static void reset();//{idList.resize(0);}
198 // static void cleanup() {if (node_p) delete node_p;node_p=0x0;}
199 // private:
200 // static TableExprNode* node_p;
201 // const String colName;
202 // static Vector<Int> idList;
203 
204 // };
205 
206 // } //# NAMESPACE CASACORE - END
207 
208 // #endif
209 //---------------------OLD CODE END (Feb. 2012)-------------------
Class to hold values from field grammar parser.
Definition: MSFieldParse.h:85
static MSFieldParse * thisMSFParser
Definition: MSFieldParse.h:99
const TableExprNode * selectFieldIds(const Vector< Int > &fieldIds)
Class to hold values from an ms grammar parser.
Definition: MSParse.h:93
Handle class for a table column expression tree.
Definition: ExprNode.h:155
MSFieldParse()
Default constructor.
static const TableExprNode * node()
Get table expression node object.
static void cleanup()
Definition: MSFieldParse.h:102
static Vector< Int > idList
Definition: MSFieldParse.h:108
static TableExprNode * node_p
Definition: MSFieldParse.h:106
static TableExprNode columnAsTEN_p
Definition: MSFieldParse.h:110
static Vector< Int > selectedIDs()
Definition: MSFieldParse.h:100
A Table intended to hold a MeasurementSet FIELD table.
Definition: MSField.h:78
A Table intended to hold astronomical data (a set of Measurements).
String: the storage and methods of handling collections of characters.
Definition: String.h:223
MeasurementSet * ms()
Get ms object.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42