casacore
Loading...
Searching...
No Matches
MSSpwParse.h
Go to the documentation of this file.
1// # MSSpwParse.h: Classes to hold results from spw 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_MSSPWPARSE_H
27#define MS_MSSPWPARSE_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/ms/MSSel/MSParse.h>
32#include <casacore/casa/Arrays/Matrix.h>
33#include <casacore/ms/MSSel/MSSelectionErrorHandler.h>
34
35namespace casacore { // # NAMESPACE CASACORE - BEGIN
36
37// # Forward Declarations
38
39// <summary>
40// Class to hold values from field 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// MSSpwParse is the class used to parse a spectral window selection command.
54// </etymology>
55
56// <synopsis> MSSpwParse is used by the parser of spectral window
57// (Spw) sub-expression statements. The parser is written in Bison
58// and Flex in files MSSpwGram.y and .l. The statements in there use
59// the routines in this file to act upon a reduced rule. Since
60// multiple tables can be given (with a shorthand), the table names
61// are stored in a list. The variable names can be qualified by the
62// table name and will be looked up in the appropriate table.
63//
64// The class MSSpwParse only contains information about a table
65// used in the table command. Global variables (like a list and a vector)
66// are used in MSSpwParse.cc to hold further information.
67//
68// Global functions are used to operate on the information.
69// The main function is the global function msSpwCommand.
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
84class MSSpwParse : public MSParse {
85 public:
86 // Default constructor
88 // ~MSSpwParse() {if (node_p) delete node_p;node_p=0x0;};
89
90 // Associate the ms and the shorthand.
92 MSSpwParse(const MSSpectralWindow& spwSubTable, const MSDataDescription& ddSubTable,
93 const TableExprNode& columnAsTEN);
95
96 const TableExprNode* selectSpwIdsFromIDList(const Vector<Int>& spwIds, const Bool addTen = True,
97 const Bool addIDs = True);
99 void selectChannelsFromIDList(Vector<Int>& spwIds, Vector<Int>& chanIDList, Int nFSpec);
100
103
104 // const TableExprNode *selectSpwOrSource(const String& fieldName);
105
106 // Get table expression node object.
107 static const TableExprNode* node();
109 static std::shared_ptr<MSSelectionErrorHandler> thisMSSpwErrorHandler;
110 static Vector<Int> selectedDDIDs() { return ddidList; }
111 static Vector<Int> selectedIDs() { return idList; }
113 static void reset() {
114 idList.resize(0);
115 chanList.resize(0, 0);
116 ddidList.resize(0);
117 };
118 static void cleanupNode() {
119 if (node_p) delete node_p;
120 node_p = 0x0;
121 }
123 static void cleanup() {
124 cleanupNode();
126 }
127
129
130 private:
137};
138
139} // namespace casacore
140
141#endif
MSParse()
Default constructor for List container class.
MeasurementSet * ms()
Get ms object.
void selectChannelsFromDefaultList(Vector< Int > &spwIds, Vector< Int > &chanDefaultList)
static Matrix< Int > chanList
Definition MSSpwParse.h:133
MSSpwParse(const MeasurementSet *ms)
~MSSpwParse() {if (node_p) delete node_p;node_p=0x0;};
static Vector< Int > ddidList
Definition MSSpwParse.h:132
static void cleanupErrorHandler()
Definition MSSpwParse.h:122
static TableExprNode * node_p
Definition MSSpwParse.h:131
static void reset()
Definition MSSpwParse.h:113
MSSpectralWindow & subTable()
Definition MSSpwParse.h:128
void selectChannelsFromIDList(Vector< Int > &spwIds, Vector< Int > &chanIDList, Int nFSpec)
const TableExprNode * selectSpwIdsFromFreqList(const Vector< Float > &spwIds, const Float factor)
static Vector< Int > selectedIDs()
Definition MSSpwParse.h:111
static const TableExprNode * node()
const TableExprNode *selectSpwOrSource(const String& fieldName);
static Vector< Int > selectedDDIDs()
Definition MSSpwParse.h:110
MSSpectralWindow spwSubTable_p
Definition MSSpwParse.h:134
static void cleanupNode()
Definition MSSpwParse.h:118
static void cleanup()
Definition MSSpwParse.h:123
const TableExprNode * selectSpwIdsFromIDList(const Vector< Int > &spwIds, const Bool addTen=True, const Bool addIDs=True)
MSSpwParse(const MSSpectralWindow &spwSubTable, const MSDataDescription &ddSubTable, const TableExprNode &columnAsTEN)
static Vector< Int > idList
Definition MSSpwParse.h:132
static TableExprNode columnAsTEN_p
Definition MSSpwParse.h:136
static MSSpwParse * thisMSSParser
Definition MSSpwParse.h:108
static Matrix< Int > selectedChanIDs()
Definition MSSpwParse.h:112
const TableExprNode * endOfCeremony(const TableExprNode &ten)
static std::shared_ptr< MSSelectionErrorHandler > thisMSSpwErrorHandler
Definition MSSpwParse.h:109
MSSpwParse()
Default constructor.
MSDataDescription ddSubTable_p
Definition MSSpwParse.h:135
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
int * factor
Definition hdu.h:521
float Float
Definition aipstype.h:52
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
const Bool True
Definition aipstype.h:41