casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: 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_MSSPWPARSE_H
29 #define MS_MSSPWPARSE_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 //# Forward Declarations
40 
41 
42 // <summary>
43 // Class to hold values from field grammar parser
44 // </summary>
45 
46 // <use visibility=local>
47 
48 // <reviewed reviewer="" date="" tests="">
49 // </reviewed>
50 
51 // <prerequisite>
52 //# Classes you should understand before using this one.
53 // </prerequisite>
54 
55 // <etymology>
56 // MSSpwParse is the class used to parse a spectral window selection command.
57 // </etymology>
58 
59 // <synopsis> MSSpwParse is used by the parser of spectral window
60 // (Spw) sub-expression statements. The parser is written in Bison
61 // and Flex in files MSSpwGram.y and .l. The statements in there use
62 // the routines in this file to act upon a reduced rule. Since
63 // multiple tables can be given (with a shorthand), the table names
64 // are stored in a list. The variable names can be qualified by the
65 // table name and will be looked up in the appropriate table.
66 //
67 // The class MSSpwParse only contains information about a table
68 // used in the table command. Global variables (like a list and a vector)
69 // are used in MSSpwParse.cc to hold further information.
70 //
71 // Global functions are used to operate on the information.
72 // The main function is the global function msSpwCommand.
73 // It executes the given STaQL command and returns the resulting ms.
74 // This is, in fact, the only function to be used by a user.
75 // </synopsis>
76 
77 // <motivation>
78 // It is necessary to be able to give a ms command in ASCII.
79 // This can be used in a CLI or in the table browser to get a subset
80 // of a table or to sort a table.
81 // </motivation>
82 
83 //# <todo asof="$DATE:$">
84 //# A List of bugs, limitations, extensions or planned refinements.
85 //# </todo>
86 
87 
88 class MSSpwParse : public MSParse
89 {
90 public:
91  // Default constructor
92  MSSpwParse ();
93  // ~MSSpwParse() {if (node_p) delete node_p;node_p=0x0;};
94 
95  // Associate the ms and the shorthand.
96  MSSpwParse (const MeasurementSet* ms);
97  MSSpwParse (const MSSpectralWindow& spwSubTable, const MSDataDescription& ddSubTable,
98  const TableExprNode& columnAsTEN);
100 
101  const TableExprNode *selectSpwIdsFromIDList(const Vector<Int>& spwIds,
102  const Bool addTen=True,
103  const Bool addIDs=True);
105  const Float factor);
107  Vector<Int>& chanIDList,
108  Int nFSpec);
109 
111  Vector<Int>& chanDefaultList);
112  const TableExprNode* endOfCeremony(const TableExprNode& ten);
113 
114  // const TableExprNode *selectSpwOrSource(const String& fieldName);
115 
116  // Get table expression node object.
117  static const TableExprNode* node();
120  static Vector<Int> selectedDDIDs() {return ddidList;}
121  static Vector<Int> selectedIDs() {return idList;}
123  static void reset() {idList.resize(0);chanList.resize(0,0);ddidList.resize(0);};
124  static void cleanupNode() {if (node_p) delete node_p;node_p=0x0;}
127 
129 private:
136 };
137 
138 } //# NAMESPACE CASACORE - END
139 
140 #endif
static void cleanupNode()
Definition: MSSpwParse.h:124
Class to hold values from field grammar parser.
Definition: MSSpwParse.h:88
int Int
Definition: aipstype.h:50
static Matrix< Int > chanList
Definition: MSSpwParse.h:132
Class to hold values from an ms grammar parser.
Definition: MSParse.h:93
static Vector< Int > selectedDDIDs()
Definition: MSSpwParse.h:120
A Table intended to hold a MeasurementSet DATADESCRIPTION table.
Handle class for a table column expression tree.
Definition: ExprNode.h:156
const TableExprNode * selectSpwIdsFromFreqList(const Vector< Float > &spwIds, const Float factor)
static MSSpwParse * thisMSSParser
Definition: MSSpwParse.h:118
Referenced counted pointer for constant data.
Definition: CountedPtr.h:80
MSSpectralWindow spwSubTable_p
Definition: MSSpwParse.h:133
const TableExprNode * endOfCeremony(const TableExprNode &ten)
static void cleanupErrorHandler()
Definition: MSSpwParse.h:125
static Vector< Int > ddidList
Definition: MSSpwParse.h:131
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
const TableExprNode * selectSpwIdsFromIDList(const Vector< Int > &spwIds, const Bool addTen=True, const Bool addIDs=True)
float Float
Definition: aipstype.h:54
MSSpectralWindow & subTable()
Definition: MSSpwParse.h:128
void selectChannelsFromDefaultList(Vector< Int > &spwIds, Vector< Int > &chanDefaultList)
A Table intended to hold astronomical data (a set of Measurements).
static CountedPtr< MSSelectionErrorHandler > thisMSSpwErrorHandler
Definition: MSSpwParse.h:119
static void reset()
Definition: MSSpwParse.h:123
void resize(size_t len, bool copyValues=false)
Definition: Vector.h:168
static Vector< Int > selectedIDs()
Definition: MSSpwParse.h:121
static Matrix< Int > selectedChanIDs()
Definition: MSSpwParse.h:122
static Vector< Int > idList
Definition: MSSpwParse.h:131
MSSpwParse()
Default constructor.
static void cleanup()
Definition: MSSpwParse.h:126
void selectChannelsFromIDList(Vector< Int > &spwIds, Vector< Int > &chanIDList, Int nFSpec)
static TableExprNode columnAsTEN_p
Definition: MSSpwParse.h:135
static const TableExprNode * node()
const TableExprNode *selectSpwOrSource(const String&amp; fieldName);
static TableExprNode * node_p
Definition: MSSpwParse.h:130
MSDataDescription ddSubTable_p
Definition: MSSpwParse.h:134
MeasurementSet * ms()
Get ms object.
const Bool True
Definition: aipstype.h:43
void resize(size_t nx, size_t ny, bool copyValues=false)
A Table intended to hold a MeasurementSet SPECTRAL_WINDOW table.