casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSScanParse.h
Go to the documentation of this file.
1 //# MSScanParse.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_MSSCANPARSE_H
29 #define MS_MSSCANPARSE_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 // MSScanParse is the class used to parse a scan command.
55 // </etymology>
56 
57 // <synopsis>
58 // MSScanParse is used by the parser of scan sub-expression statements.
59 // The parser is written in Bison and Flex in files MSScanGram.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 MSScanParse only contains information about a table
67 // used in the table command. Global variables (like a list and a vector)
68 // are used in MSScanParse.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 
87 class MSScanParse : public MSParse
88 {
89 
90 public:
91  // Default constructor
92  MSScanParse ();
93 
94  // Associate the ms and the shorthand.
95  MSScanParse (const MeasurementSet* ms);
96  MSScanParse (const MeasurementSet* ms, 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 *selectScanIds(const Vector<Int>& scanids);
103  const TableExprNode *selectScanIdsGT(const Vector<Int>& scanids);
104  const TableExprNode *selectScanIdsLT(const Vector<Int>& scanids);
105  const TableExprNode *selectScanIdsGTEQ(const Vector<Int>& scanids);
106  const TableExprNode *selectScanIdsLTEQ(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  void reset(){idList.resize(0);parsedIDList_p.resize(0);}
114  void cleanup() {}
115 
116  void setMaxScan(const Int& n) {maxScans_p=n;}
117 
119 
120 private:
123  std::vector<Int> parsedIDList_p;
125  void appendToIDList(const Vector<Int>& v);
128 };
129 
130 } //# NAMESPACE CASACORE - END
131 
132 #endif
const TableExprNode * selectRangeGEAndLE(const Int &n0, const Int &n1)
const TableExprNode * selectScanIds()
Definition: MSScanParse.h:102
int Int
Definition: aipstype.h:50
Class to hold values from an ms grammar parser.
Definition: MSParse.h:93
Handle class for a table column expression tree.
Definition: ExprNode.h:156
Vector< Int > idList
Definition: MSScanParse.h:122
Vector< Int > selectedIDs()
Definition: MSScanParse.h:112
const TableExprNode * selectScanIdsGT(const Vector< Int > &scanids)
void appendToIDList(const Vector< Int > &v)
const TableExprNode * selectScanIdsLTEQ(const Vector< Int > &scanids)
const TableExprNode * selectScanIdsGTEQ(const Vector< Int > &scanids)
void setMaxScan(const Int &n)
Definition: MSScanParse.h:116
const TableExprNode * selectRangeGTAndLT(const Int &n0, const Int &n1)
TableExprNode node_p
Definition: MSScanParse.h:121
MSScanParse()
Default constructor.
const TableExprNode node()
Get table expression node object.
const TableExprNode * selectScanIdsLT(const Vector< Int > &scanids)
A Table intended to hold astronomical data (a set of Measurements).
Class to hold values from scan grammar parser.
Definition: MSScanParse.h:87
void resize(size_t len, bool copyValues=false)
Definition: Vector.h:168
std::vector< Int > parsedIDList_p
Definition: MSScanParse.h:123
std::vector< Int > & accumulateIDs(const Int id0, const Int id1=-1)
String: the storage and methods of handling collections of characters.
Definition: String.h:225
MeasurementSet * ms()
Get ms object.
static MSScanParse * thisMSSParser
Definition: MSScanParse.h:118
const String colName
Definition: MSScanParse.h:124
static TableExprNode columnAsTEN_p
Definition: MSScanParse.h:127