MSObservationParse.h

Go to the documentation of this file.
00001 //# MSObservationParse.h: Classes to hold results from scan grammar parser
00002 //# Copyright (C) 1994,1995,1997,1998,1999,2000,2001,2003
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 #ifndef MS_MSOBSERVATIONPARSE_H
00029 #define MS_MSOBSERVATIONPARSE_H
00030 
00031 //# Includes
00032 #include <casacore/casa/aips.h>
00033 #include <casacore/ms/MSSel/MSParse.h>
00034 #include <casacore/measures/Measures/MEpoch.h>
00035 
00036 namespace casacore { //# NAMESPACE CASACORE - BEGIN
00037 
00038 //# Forward Declarations
00039 
00040 // <summary>
00041 // Class to hold values from scan grammar parser
00042 // </summary>
00043 
00044 // <use visibility=local>
00045 
00046 // <reviewed reviewer="" date="" tests="">
00047 // </reviewed>
00048 
00049 // <prerequisite>
00050 //# Classes you should understand before using this one.
00051 // </prerequisite>
00052 
00053 // <etymology>
00054 // MSObservationParse is the class used to parse a scan command.
00055 // </etymology>
00056 
00057 // <synopsis>
00058 // MSObservationParse is used by the parser of scan sub-expression statements.
00059 // The parser is written in Bison and Flex in files MSObservationGram.y and .l.
00060 // The statements in there use the routines in this file to act
00061 // upon a reduced rule.
00062 // Since multiple tables can be given (with a shorthand), the table
00063 // names are stored in a list. The variable names can be qualified
00064 // by the table name and will be looked up in the appropriate table.
00065 //
00066 // The class MSObservationParse only contains information about a table
00067 // used in the table command. Global variables (like a list and a vector)
00068 // are used in MSObservationParse.cc to hold further information.
00069 //
00070 // Global functions are used to operate on the information.
00071 // The main function is the global function msScanCommand.
00072 // It executes the given STaQL command and returns the resulting ms.
00073 // This is, in fact, the only function to be used by a user.
00074 // </synopsis>
00075 
00076 // <motivation>
00077 // It is necessary to be able to give a ms command in ASCII.
00078 // This can be used in a CLI or in the table browser to get a subset
00079 // of a table or to sort a table.
00080 // </motivation>
00081 
00082 //# <todo asof="$DATE:$">
00083 //# A List of bugs, limitations, extensions or planned refinements.
00084 //# </todo>
00085 
00086 
00087 class MSObservationParse : public MSParse
00088 {
00089 
00090 public:
00091   // Default constructor
00092   MSObservationParse ();
00093   
00094   // Associate the ms and the shorthand.
00095   MSObservationParse (const MeasurementSet* ms, const MSObservation& obsSubtable,
00096                       const TableExprNode& colAsTEN);
00097   ~MSObservationParse() {columnAsTEN_p=TableExprNode();}
00098 
00099   const TableExprNode *selectRangeGTAndLT(const Int& n0, const Int& n1);
00100   const TableExprNode *selectRangeGEAndLE(const Int& n0, const Int& n1);
00101   const TableExprNode *selectObservationIds(const Vector<Int>& scanids);
00102   inline const TableExprNode *selectObservationIds() {return selectObservationIds(parsedIDList_p);}
00103   const TableExprNode *selectObservationIdsGT(const Vector<Int>& scanids);
00104   const TableExprNode *selectObservationIdsLT(const Vector<Int>& scanids);
00105   const TableExprNode *selectObservationIdsGTEQ(const Vector<Int>& scanids);
00106   const TableExprNode *selectObservationIdsLTEQ(const Vector<Int>& scanids);
00107   std::vector<Int>& accumulateIDs(const Int id0, const Int id1=-1);
00108 
00109     // Get table expression node object.
00110   const TableExprNode node();
00111 
00112   Vector<Int> selectedIDs();
00113 
00114   void reset(){idList.resize(0);}
00115   void cleanup() {}
00116 
00117   void setMaxObs(const Int& n) {maxObs_p=n;}
00118 
00119   static MSObservationParse* thisMSObsParser;
00120 
00121 private:
00122   TableExprNode node_p;
00123   Vector<Int> idList,obsIDList_p;
00124   std::vector<Int>  parsedIDList_p;
00125   const String colName;
00126   void appendToIDList(const Vector<Int>& v);
00127   Int maxObs_p;
00128   static TableExprNode columnAsTEN_p;
00129 };
00130 
00131 } //# NAMESPACE CASACORE - END
00132 
00133 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1