casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSParse.h
Go to the documentation of this file.
1 //# MSParse.h: Classes to hold results from an ms 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_MSPARSE_H
29 #define MS_MSPARSE_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
35 
39 
40 namespace casacore { //# NAMESPACE CASACORE - BEGIN
41 
42 //# Forward Declarations
43 class AipsIO;
44 
45 
46 // <summary>
47 // Class to hold values from an ms grammar parser
48 // </summary>
49 
50 // <use visibility=local>
51 
52 // <reviewed reviewer="" date="" tests="">
53 // </reviewed>
54 
55 // <prerequisite>
56 //# Classes you should understand before using this one.
57 // </prerequisite>
58 
59 // <etymology>
60 // MSParse is the class used to parse an ms command.
61 // </etymology>
62 
63 // <synopsis>
64 // MSParse is used by the parser of an ms sub-expression statements.
65 // The parser is written in Bison and Flex in files MSXXXGram.y and .l.
66 // The statements in there use the routines in this file to act
67 // upon a reduced rule.
68 // Since multiple tables can be given (with a shorthand), the table
69 // names are stored in a list. The variable names can be qualified
70 // by the table name and will be looked up in the appropriate table.
71 //
72 // The class MSParse only contains information about an ms
73 // used in the ms command. Global variables (like a list and a vector)
74 // are used in MSParse.cc to hold further information.
75 //
76 // Global functions are used to operate on the information.
77 // The main function is the global function msXXXCommand.
78 // It executes the given STaQL command and returns the resulting ms.
79 // This is, in fact, the only function to be used by a user.
80 // </synopsis>
81 
82 // <motivation>
83 // It is necessary to be able to give a ms command in ASCII.
84 // This can be used in a CLI or in the table browser to get a subset
85 // of a table or to sort a table.
86 // </motivation>
87 
88 //# <todo asof="$DATE:$">
89 //# A List of bugs, limitations, extensions or planned refinements.
90 //# </todo>
91 
92 
93 class MSParse
94 {
95 // Dummy AipsIO routines; they are needed for the List container.
96 // <group>
97 friend AipsIO& operator<< (AipsIO&, const MSParse&);
98 friend AipsIO& operator>> (AipsIO&, MSParse&);
99 // </group>
100 
101 public:
102  // Default constructor for List container class.
103  MSParse ();
104 
105  // Copy constructor (copy semantics).
106  MSParse (const MSParse&);
107 
108  ~MSParse ();
109 
110  // Assignment (copy semantics).
111  MSParse& operator= (const MSParse&);
112 
113  // Associate the ms and the shorthand.
114  MSParse (const MeasurementSet* ms, const String& shorthand);
115  // Associate the ms and the shorthand.
116  MSParse (const MSSelectableTable* ms, const String& shorthand);
117 
118  // Test if shorthand matches.
119  Bool test (const String& shortHand) const;
120 
121  // Get the shorthand.
122  String& shorthand();
123 
124  // Get ms object.
125  MeasurementSet* ms();
126  // Get ms object.
128 
133  void addCondition(TableExprNode& target, TableExprNode& source);
134 
135 private:
137  // The following exists for the period we make the transition from
138  // using MS to using MSSelectableTable. Till then, both interfaces
139  // have to be supported.
141 };
142 
143 } //# NAMESPACE CASACORE - END
144 
145 #endif
void addCondition(TableExprNode &target, TableExprNode &source)
MSParse()
Default constructor for List container class.
Class to hold values from an ms grammar parser.
Definition: MSParse.h:93
AipsIO is the object persistency mechanism of Casacore.
Definition: AipsIO.h:168
String & shorthand()
Get the shorthand.
Handle class for a table column expression tree.
Definition: ExprNode.h:155
String shorthand_p
Definition: MSParse.h:136
void setMS(MeasurementSet *ms)
Definition: MSParse.h:129
Bool test(const String &shortHand) const
Test if shorthand matches.
static MSSelectableTable * msInterface_p
Definition: MSParse.h:132
friend AipsIO & operator<<(AipsIO &, const MSParse &)
Dummy AipsIO routines; they are needed for the List container.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
MSSelectableTable: An interface class used by MSSelection module to access the sub-tables and main-ta...
static MeasurementSet * ms_p
Definition: MSParse.h:131
friend AipsIO & operator>>(AipsIO &, MSParse &)
A Table intended to hold astronomical data (a set of Measurements).
MSSelectableTable * msInterface()
Get ms object.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
MSSelectableTable * tempMSInterface_p
The following exists for the period we make the transition from using MS to using MSSelectableTable...
Definition: MSParse.h:140
MSParse & operator=(const MSParse &)
Assignment (copy semantics).
MeasurementSet * ms()
Get ms object.
void setMSInterface(MSSelectableTable *msI)
Definition: MSParse.h:130
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42