casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSStateParse.h
Go to the documentation of this file.
1 //# MSStateParse.h: Classes to hold results from field 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_MSSTATEPARSE_H
29 #define MS_MSSTATEPARSE_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 //# Forward
40 // <summary>
41 // Class to hold values from field 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 // MSStateParse is the class used to parse a field command.
55 // </etymology>
56 
57 // <synopsis>
58 // MSStateParse is used by the parser of field sub-expression statements.
59 // The parser is written in Bison and Flex in files MSStateGram.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 MSStateParse only contains information about a table
67 // used in the table command. Global variables (like a list and a vector)
68 // are used in MSStateParse.cc to hold further information.
69 //
70 // Global functions are used to operate on the information.
71 // The main function is the global function msStateCommand.
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 MSStateParse : public MSParse
88 {
89 public:
90  // Default constructor
91  MSStateParse();
92 
93  // Associate the ms and the shorthand.
95 
96  const TableExprNode* selectStateIds(const Vector<Int>& stateIDs);
97 
98  // Get table expression node object.
99  static const TableExprNode* node();
102  //static MSSelectionErrorHandler* thisMSSErrorHandler;
103  static Vector<Int> selectedIDs() {return idList;};
104  static void reset(){idList.resize(0);};
105  static void cleanupNode() {if (node_p) delete node_p;node_p=0x0;}
106  static void cleanupErrorHandler() {thisMSSErrorHandler.reset();}
108 private:
112 };
113 
114 } //# NAMESPACE CASACORE - END
115 
116 #endif
Class to hold values from field grammar parser.
Definition: MSStateParse.h:87
Class to hold values from an ms grammar parser.
Definition: MSParse.h:93
Handle class for a table column expression tree.
Definition: ExprNode.h:156
static void cleanupErrorHandler()
Definition: MSStateParse.h:106
static CountedPtr< MSSelectionErrorHandler > thisMSSErrorHandler
Definition: MSStateParse.h:101
static Vector< Int > selectedIDs()
static MSSelectionErrorHandler* thisMSSErrorHandler;
Definition: MSStateParse.h:103
static void cleanupNode()
Definition: MSStateParse.h:105
Referenced counted pointer for constant data.
Definition: CountedPtr.h:80
static Vector< Int > idList
Definition: MSStateParse.h:111
A Table intended to hold astronomical data (a set of Measurements).
void resize(size_t len, bool copyValues=false)
Definition: Vector.h:168
const TableExprNode * selectStateIds(const Vector< Int > &stateIDs)
MSStateParse()
Default constructor.
static TableExprNode * node_p
Definition: MSStateParse.h:109
static MSStateParse * thisMSSIParser
Definition: MSStateParse.h:100
String: the storage and methods of handling collections of characters.
Definition: String.h:225
static void cleanup()
Definition: MSStateParse.h:107
MeasurementSet * ms()
Get ms object.
static const TableExprNode * node()
Get table expression node object.