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
85class MSFeedParse : public MSParse {
86 public:
87 // Define the operator types (&&&, &&, and &).
88 // NB: Keeping the same notation as Antenna parser, even tho not a baseline here!
90
91 // Default constructor
93
94 // Associate the ms.
96
97 MSFeedParse(const MSFeed& feedSubTable, const TableExprNode& feed1AsTEN,
98 const TableExprNode& feed2AsTEN);
99
104
105 // Add the given feed selection.
107 BaselineListType baselineType = CrossOnly,
108 Bool negate = False);
109
110 // Add the given "baseline" selection.
111 const TableExprNode* selectFeedIds(const Vector<Int>& feedIds1, const Vector<Int>& feedIds2,
112 BaselineListType baselineType = CrossOnly,
113 Bool negate = False);
114
115 // Get a pointer to the table expression node object.
116 TableExprNode node() const { return node_p; }
117 const Vector<Int>& selectedFeed1() const { return feed1List; }
118 const Vector<Int>& selectedFeed2() const { return feed2List; }
119 const Matrix<Int>& selectedFeedPairs() const { return feedPairList; }
120
122
123 private:
125 Bool negate = False);
126 void makeFeedPairList(const Vector<Int>& f1, const Vector<Int>& f2, Matrix<Int>& fp,
127 BaselineListType baselineType = CrossOnly, Bool negate = False);
128 void makeFeedList(Vector<Int>& feedList, const Vector<Int>& thisList, Bool negate = False);
129 Bool addFeedPair(const Matrix<Int>& feedpairlist, const Int feed1, const Int feed2,
130 BaselineListType baselineType = CrossOnly);
131
132 // # Data members.
133 public:
135 static std::shared_ptr<MSSelectionErrorHandler> thisMSFErrorHandler;
136 static void cleanupErrorHandler() { thisMSFErrorHandler.reset(); }
137
138 private:
145};
146
147} // namespace casacore
148
149#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:89
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
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