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