casacore
Loading...
Searching...
No Matches
MSArrayParse.h
Go to the documentation of this file.
1//# MSArrayParse.h: Classes to hold results from array 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_MSARRAYPARSE_H
27#define MS_MSARRAYPARSE_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/ms/MSSel/MSParse.h>
32#include <casacore/measures/Measures/MEpoch.h>
33
34namespace casacore { //# NAMESPACE CASACORE - BEGIN
35
36//# Forward Declarations
37
38// <summary>
39// Class to hold values from array grammar parser
40// </summary>
41
42// <use visibility=local>
43
44// <reviewed reviewer="" date="" tests="">
45// </reviewed>
46
47// <prerequisite>
48//# Classes you should understand before using this one.
49// </prerequisite>
50
51// <etymology>
52// MSArrayParse is the class used to parse a array command.
53// </etymology>
54
55// <synopsis>
56// MSArrayParse is used by the parser of array sub-expression statements.
57// The parser is written in Bison and Flex in files MSArrayGram.y and .l.
58// The statements in there use the routines in this file to act
59// upon a reduced rule.
60// Since multiple tables can be given (with a shorthand), the table
61// names are stored in a list. The variable names can be qualified
62// by the table name and will be looked up in the appropriate table.
63//
64// The class MSArrayParse only contains information about a table
65// used in the table command. Global variables (like a list and a vector)
66// are used in MSArrayParse.cc to hold further information.
67//
68// Global functions are used to operate on the information.
69// The main function is the global function msArrayCommand.
70// It executes the given STaQL command and returns the resulting ms.
71// This is, in fact, the only function to be used by a user.
72// </synopsis>
73
74// <motivation>
75// It is necessary to be able to give a ms command in ASCII.
76// This can be used in a CLI or in the table browser to get a subset
77// of a table or to sort a table.
78// </motivation>
79
80//# <todo asof="$DATE:$">
81//# A List of bugs, limitations, extensions or planned refinements.
82//# </todo>
83
84
85class MSArrayParse : public MSParse
86{
87
88public:
89 // Default constructor
91
92 // Associate the ms and the shorthand.
94
95 // ~MSArrayParse() {if (node_p) delete node_p;node_p=0x0;}
96
97 const TableExprNode *selectRangeGTAndLT(const Int& n0, const Int& n1);
98 const TableExprNode *selectRangeGEAndLE(const Int& n0, const Int& n1);
99 const TableExprNode *selectArrayIds(const Vector<Int>& arrayids);
105 std::vector<Int>& accumulateIDs(const Int id0, const Int id1=-1);
106
107 // Get table expression node object.
109
111 void reset(){idList.resize(0);parsedIDList_p.resize(0);}
112 void cleanup() {}
113
114 void setMaxArray(const Int& n) {maxArrays_p=n;}
115
117
118private:
121 std::vector<Int> parsedIDList_p;
125};
126
127} //# NAMESPACE CASACORE - END
128
129#endif
std::vector< Int > parsedIDList_p
const TableExprNode * selectArrayIdsLTEQ(const Vector< Int > &arrayids)
static MSArrayParse * thisMSAParser
const TableExprNode * selectRangeGEAndLE(const Int &n0, const Int &n1)
void setMaxArray(const Int &n)
MSArrayParse()
Default constructor.
Vector< Int > selectedIDs()
void appendToIDList(const Vector< Int > &v)
const TableExprNode * selectRangeGTAndLT(const Int &n0, const Int &n1)
~MSArrayParse() {if (node_p) delete node_p;node_p=0x0;}
const TableExprNode * selectArrayIds(const Vector< Int > &arrayids)
MSArrayParse(const MeasurementSet *ms)
Associate the ms and the shorthand.
const TableExprNode * selectArrayIdsLT(const Vector< Int > &arrayids)
const TableExprNode * selectArrayIdsGT(const Vector< Int > &arrayids)
std::vector< Int > & accumulateIDs(const Int id0, const Int id1=-1)
const TableExprNode * selectArrayIds()
const TableExprNode node()
Get table expression node object.
const TableExprNode * selectArrayIdsGTEQ(const Vector< Int > &arrayids)
MeasurementSet * ms()
Get ms object.
String: the storage and methods of handling collections of characters.
Definition String.h:223
void resize(size_t len, bool copyValues=false)
Definition Vector.h:164
this file contains all the compiler specific defines
Definition mainpage.dox:28
int Int
Definition aipstype.h:48