casacore
Loading...
Searching...
No Matches
MSFeedParse.h
Go to the documentation of this file.
1//# MSFeedParse.h: Classes to hold results from feed grammar parser
2//# Copyright (C) 2015
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_MSFEEDPARSE_H
27#define MS_MSFEEDPARSE_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/ms/MSSel/MSParse.h>
32#include <casacore/ms/MSSel/MSSelectionErrorHandler.h>
33#include <casacore/casa/Arrays/Matrix.h>
34
35namespace casacore { //# NAMESPACE CASACORE - BEGIN
36
37 //# Forward Declarations
38
39 // <summary>
40 // Class to hold values from feed grammar parser
41 // </summary>
42
43 // <use visibility=local>
44
45 // <reviewed reviewer="" date="" tests="">
46 // </reviewed>
47
48 // <prerequisite>
49 //# Classes you should understand before using this one.
50 // </prerequisite>
51
52 // <etymology>
53 // MSFeedParse is the class used to parse a feed command.
54 // </etymology>
55
56 // <synopsis>
57 // MSFeedParse is used by the parser of feed sub-expression statements.
58 // The parser is written in Bison and Flex in files MSFeedGram.yy and .ll.
59 // The statements there use the routines in this file to act
60 // upon a reduced rule.
61 // Since multiple tables can be given (with a shorthand), the table
62 // names are stored in a list. The variable names can be qualified
63 // by the table name and will be looked up in the appropriate table.
64 //
65 // The class MSFeedParse only contains information about a table
66 // used in the table command. Global variables (like a list and a vector)
67 // are used in MSFeedParse.cc to hold further information.
68 //
69 // Global functions are used to operate on the information.
70 // The main function is the global function msFeedCommand.
71 // It executes the given STaQL command and returns the resulting ms.
72 // This is, in fact, the only function to be used by a user.
73 // </synopsis>
74
75 // <motivation>
76 // It is necessary to be able to give a ms command in ASCII.
77 // This can be used in a CLI or in the table browser to get a subset
78 // of a table or to sort a table.
79 // </motivation>
80
81 //# <todo asof="$DATE:$">
82 //# A List of bugs, limitations, extensions or planned refinements.
83 //# </todo>
84
85
86 class MSFeedParse : public MSParse
87 {
88
89 public:
90 // Define the operator types (&&&, &&, and &).
91 // NB: Keeping the same notation as Antenna parser, even tho not a baseline here!
93
94 // Default constructor
96
97 // Associate the ms.
99
100 MSFeedParse (const MSFeed& feedSubTable,
101 const TableExprNode& feed1AsTEN, const TableExprNode& feed2AsTEN);
102
104
105 // Add the given feed selection.
107 BaselineListType baselineType=CrossOnly,
108 Bool negate=False);
109
110 // Add the given "baseline" selection.
112 const Vector<Int>& feedIds2,
113 BaselineListType baselineType=CrossOnly,
114 Bool negate=False);
115
116 // Get a pointer to the table expression node object.
118 { return node_p; }
120 { return feed1List; }
122 { return feed2List; }
124 { return feedPairList; }
125
127
128 private:
129
131 BaselineListType baselineType=CrossOnly,
132 Bool negate=False);
134 BaselineListType baselineType=CrossOnly,
135 Bool negate=False);
136 void makeFeedList(Vector<Int>& feedList,const Vector<Int>& thisList,
137 Bool negate=False);
138 Bool addFeedPair(const Matrix<Int>& feedpairlist,
139 const Int feed1, const Int feed2,
140 BaselineListType baselineType=CrossOnly);
141
142 //# Data members.
143 public:
145 static std::shared_ptr<MSSelectionErrorHandler> thisMSFErrorHandler;
147 private:
154 };
155
156} //# NAMESPACE CASACORE - END
157
158#endif
const TableExprNode * setTEN(TableExprNode &condition, BaselineListType baselineType=CrossOnly, Bool negate=False)
void makeFeedPairList(const Vector< Int > &f1, const Vector< Int > &f2, Matrix< Int > &fp, BaselineListType baselineType=CrossOnly, Bool negate=False)
static void cleanupErrorHandler()
void makeFeedList(Vector< Int > &feedList, const Vector< Int > &thisList, Bool negate=False)
Matrix< Int > feedPairList
Vector< Int > feed2List
MSFeedParse(const MeasurementSet *ms)
Associate the ms.
static TableExprNode column1AsTEN_p
const Matrix< Int > & selectedFeedPairs() const
const TableExprNode * selectFeedIds(const Vector< Int > &feedIds1, const Vector< Int > &feedIds2, BaselineListType baselineType=CrossOnly, Bool negate=False)
Add the given "baseline" selection.
const Vector< Int > & selectedFeed2() const
static TableExprNode column2AsTEN_p
TableExprNode node() const
Get a pointer to the table expression node object.
const TableExprNode * selectFeedIds(const Vector< Int > &feedIds, BaselineListType baselineType=CrossOnly, Bool negate=False)
Add the given feed selection.
Vector< Int > feed1List
const Vector< Int > & selectedFeed1() const
TableExprNode node_p
MSFeedParse(const MSFeed &feedSubTable, const TableExprNode &feed1AsTEN, const TableExprNode &feed2AsTEN)
static std::shared_ptr< MSSelectionErrorHandler > thisMSFErrorHandler
const String colName2
Bool addFeedPair(const Matrix< Int > &feedpairlist, const Int feed1, const Int feed2, BaselineListType baselineType=CrossOnly)
const String colName1
MSFeedParse()
Default constructor.
static MSFeedParse * thisMSFParser
BaselineListType
Define the operator types (&&&, &&, and &).
Definition MSFeedParse.h:92
MeasurementSet * ms()
Get ms object.
String: the storage and methods of handling collections of characters.
Definition String.h:223
this file contains all the compiler specific defines
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40