casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSObservationParse.h
Go to the documentation of this file.
1 //# MSObservationParse.h: Classes to hold results from scan 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_MSOBSERVATIONPARSE_H
29 #define MS_MSOBSERVATIONPARSE_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 //# Forward Declarations
39 
40 // <summary>
41 // Class to hold values from scan grammar parser
42 // </summary>
43 
44 // <use visibility=local>
45 
46 // <reviewed reviewer="" date="" tests="">
47 // </reviewed>
48 
49 // <prerequisite>
50 //# Classes you should understand before using this one.
51 // </prerequisite>
52 
53 // <etymology>
54 // MSObservationParse is the class used to parse a scan command.
55 // </etymology>
56 
57 // <synopsis>
58 // MSObservationParse is used by the parser of scan sub-expression statements.
59 // The parser is written in Bison and Flex in files MSObservationGram.y and .l.
60 // The statements in there use the routines in this file to act
61 // upon a reduced rule.
62 // Since multiple tables can be given (with a shorthand), the table
63 // names are stored in a list. The variable names can be qualified
64 // by the table name and will be looked up in the appropriate table.
65 //
66 // The class MSObservationParse only contains information about a table
67 // used in the table command. Global variables (like a list and a vector)
68 // are used in MSObservationParse.cc to hold further information.
69 //
70 // Global functions are used to operate on the information.
71 // The main function is the global function msScanCommand.
72 // It executes the given STaQL command and returns the resulting ms.
73 // This is, in fact, the only function to be used by a user.
74 // </synopsis>
75 
76 // <motivation>
77 // It is necessary to be able to give a ms command in ASCII.
78 // This can be used in a CLI or in the table browser to get a subset
79 // of a table or to sort a table.
80 // </motivation>
81 
82 //# <todo asof="$DATE:$">
83 //# A List of bugs, limitations, extensions or planned refinements.
84 //# </todo>
85 
86 
88 {
89 
90 public:
91  // Default constructor
93 
94  // Associate the ms and the shorthand.
95  MSObservationParse (const MeasurementSet* ms, const MSObservation& obsSubtable,
96  const TableExprNode& colAsTEN);
98 
99  const TableExprNode *selectRangeGTAndLT(const Int& n0, const Int& n1);
100  const TableExprNode *selectRangeGEAndLE(const Int& n0, const Int& n1);
101  const TableExprNode *selectObservationIds(const Vector<Int>& scanids);
103  const TableExprNode *selectObservationIdsGT(const Vector<Int>& scanids);
104  const TableExprNode *selectObservationIdsLT(const Vector<Int>& scanids);
105  const TableExprNode *selectObservationIdsGTEQ(const Vector<Int>& scanids);
106  const TableExprNode *selectObservationIdsLTEQ(const Vector<Int>& scanids);
107  std::vector<Int>& accumulateIDs(const Int id0, const Int id1=-1);
108 
109  // Get table expression node object.
110  const TableExprNode node();
111 
113 
114  void reset(){idList.resize(0);}
115  void cleanup() {}
116 
117  void setMaxObs(const Int& n) {maxObs_p=n;}
118 
120 
121 private:
124  std::vector<Int> parsedIDList_p;
126  void appendToIDList(const Vector<Int>& v);
129 };
130 
131 } //# NAMESPACE CASACORE - END
132 
133 #endif
int Int
Definition: aipstype.h:50
const TableExprNode * selectObservationIdsLT(const Vector< Int > &scanids)
std::vector< Int > & accumulateIDs(const Int id0, const Int id1=-1)
Class to hold values from an ms grammar parser.
Definition: MSParse.h:93
A Table intended to hold a MeasurementSet OBSERVATION table.
Definition: MSObservation.h:78
const TableExprNode * selectRangeGTAndLT(const Int &n0, const Int &n1)
MSObservationParse()
Default constructor.
Handle class for a table column expression tree.
Definition: ExprNode.h:156
const TableExprNode * selectObservationIdsGTEQ(const Vector< Int > &scanids)
const TableExprNode * selectObservationIdsLTEQ(const Vector< Int > &scanids)
const TableExprNode * selectObservationIdsGT(const Vector< Int > &scanids)
void appendToIDList(const Vector< Int > &v)
static MSObservationParse * thisMSObsParser
static TableExprNode columnAsTEN_p
const TableExprNode * selectRangeGEAndLE(const Int &n0, const Int &n1)
A Table intended to hold astronomical data (a set of Measurements).
void resize(size_t len, bool copyValues=false)
Definition: Vector.h:168
const TableExprNode * selectObservationIds()
const TableExprNode node()
Get table expression node object.
String: the storage and methods of handling collections of characters.
Definition: String.h:225
MeasurementSet * ms()
Get ms object.
Class to hold values from scan grammar parser.