casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSUvDistParse.h
Go to the documentation of this file.
1 //# MSUvDistParse.h: Classes to hold results from UV dist 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_MSUVDISTPARSE_H
29 #define MS_MSUVDISTPARSE_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 //# Forward Declarations
39 
40 // <summary>
41 // Class to hold values from UV dist grammar parser
42 // </summary>
43 
44 // <use visibility=local>
45 
46 // <reviewed reviewer="" date="" tests="">
47 // </reviewed>
48 
49 // <prerequisite>
50 //# Classes you should understand before using this one.
51 // </prerequisite>
52 
53 // <etymology>
54 // MSUvDistParse is the class used to parse a UV dist command.
55 // </etymology>
56 
57 // <synopsis>
58 // MSUvDistParse is used by the parser of UV dist sub-expression statements.
59 // The parser is written in Bison and Flex in files MSUvDistGram.y and .l.
60 // The statements in there use the routines in this file to act
61 // upon a reduced rule.
62 // Since multiple tables can be given (with a shorthand), the table
63 // names are stored in a list. The variable names can be qualified
64 // by the table name and will be looked up in the appropriate table.
65 //
66 // The class MSUvDistParse only contains information about a table
67 // used in the table command. Global variables (like a list and a vector)
68 // are used in MSUvDistParse.cc to hold further information.
69 //
70 // Global functions are used to operate on the information.
71 // The main function is the global function msUvDistCommand.
72 // It executes the given STaQL command and returns the resulting ms.
73 // This is, in fact, the only function to be used by a user.
74 // </synopsis>
75 
76 // <motivation>
77 // It is necessary to be able to give a ms command in ASCII.
78 // This can be used in a CLI or in the table browser to get a subset
79 // of a table or to sort a table.
80 // </motivation>
81 
82 //# <todo asof="$DATE:$">
83 //# A List of bugs, limitations, extensions or planned refinements.
84 //# </todo>
85 
86 
87  class MSUvDistParse : public MSParse
88  {
89 
90  public:
91  // Default constructor
92  MSUvDistParse ();
93 
94  // Associate the ms and the shorthand.
96 
97  // ~MSUvDistParse() {if (node_p) delete node_p;node_p=0x0;}
98 
99  const TableExprNode *selectUVRange(const Double& startUV,
100  const Double& endUV,
101  const String& unit,
102  Bool doSlow=False);
103 
106  static void reset(){selectedUV_p.resize(2,0);meterUnits_p.resize(0);}
107  static void cleanup() {if (node_p) delete node_p;node_p=0x0;}
108 
109  // Get table expression node object.
110  static const TableExprNode* node();
112 
113  private:
117  void accumulateUVList(const Double r0, const Double r1,
118  const Bool wavelengthUnits,
119  const Bool meterUnits);
120 
121  };
122 
123 } //# NAMESPACE CASACORE - END
124 
125 #endif
Class to hold values from an ms grammar parser.
Definition: MSParse.h:93
const TableExprNode * selectUVRange(const Double &startUV, const Double &endUV, const String &unit, Bool doSlow=False)
~MSUvDistParse() {if (node_p) delete node_p;node_p=0x0;}
Handle class for a table column expression tree.
Definition: ExprNode.h:156
void accumulateUVList(const Double r0, const Double r1, const Bool wavelengthUnits, const Bool meterUnits)
double Double
Definition: aipstype.h:55
static Matrix< Double > selectedUV_p
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
static MSUvDistParse * thisMSUParser
Matrix< Double > selectedUV()
const Bool False
Definition: aipstype.h:44
static const TableExprNode * node()
Get table expression node object.
A Table intended to hold astronomical data (a set of Measurements).
void resize(size_t len, bool copyValues=false)
Definition: Vector.h:168
static Vector< Bool > meterUnits_p
String: the storage and methods of handling collections of characters.
Definition: String.h:225
MSUvDistParse()
Default constructor.
MeasurementSet * ms()
Get ms object.
Vector< Bool > selectedUnits()
Class to hold values from UV dist grammar parser.
Definition: MSUvDistParse.h:87
void resize(size_t nx, size_t ny, bool copyValues=false)
static TableExprNode * node_p