casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
MSFieldParse.h
Go to the documentation of this file.
00001 //# MSFieldParse.h: Classes to hold results from field 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_MSFIELDPARSE_H
00029 #define MS_MSFIELDPARSE_H
00030 
00031 //# Includes
00032 #include <ms/MeasurementSets/MSField.h>
00033 #include <ms/MeasurementSets/MSFieldColumns.h>
00034 #include <ms/MeasurementSets/MSParse.h>
00035 #include <ms/MeasurementSets/MSSelectionError.h>
00036 #include <ms/MeasurementSets/MSSelectableTable.h>
00037 namespace casa { //# NAMESPACE CASA - BEGIN
00038 
00039 //# Forward Declarations
00040 
00041 
00042 // <motivation>
00043 // It is necessary to be able to give a ms command in ASCII.
00044 // This can be used in a CLI or in the table browser to get a subset
00045 // of a table or to sort a table.
00046 // </motivation>
00047 
00048 // <summary>
00049 // Class to hold values from field grammar parser
00050 // </summary>
00051 
00052 // <use visibility=local>
00053 
00054 // <reviewed reviewer="" date="" tests="">
00055 // </reviewed>
00056 
00057 // <prerequisite>
00058 //# Classes you should understand before using this one.
00059 // </prerequisite>
00060 
00061 // <etymology>
00062 // MSFieldParse is the class used to parse a field command.
00063 // </etymology>
00064 
00065 // <synopsis>
00066 // MSFieldParse is used by the parser of field sub-expression statements.
00067 // The parser is written in Bison and Flex in files MSFieldGram.y and .l.
00068 // The statements in there use the routines in this file to act
00069 // upon a reduced rule.
00070 // Since multiple tables can be given (with a shorthand), the table
00071 // names are stored in a list. The variable names can be qualified
00072 // by the table name and will be looked up in the appropriate table.
00073 //
00074 // The class MSFieldParse only contains information about a table
00075 // used in the table command. Global variables (like a list and a vector)
00076 // are used in MSFieldParse.cc to hold further information.
00077 //
00078 // Global functions are used to operate on the information.
00079 // The main function is the global function msFieldCommand.
00080 // It executes the given STaQL command and returns the resulting ms.
00081 // This is, in fact, the only function to be used by a user.
00082 // </synopsis>
00083 
00084   class MSFieldParse : public MSParse
00085   {
00086     
00087   public:
00088     // Default constructor
00089     MSFieldParse ();
00090     MSFieldParse (const MeasurementSet* ms);
00091     MSFieldParse (const MSField& fieldSubTable, const TableExprNode& columnAsTEN);
00092     ~MSFieldParse() {columnAsTEN_p=TableExprNode();};
00093 
00094     const TableExprNode *selectFieldIds(const Vector<Int>& fieldIds);
00095     
00096     // Get table expression node object.
00097     static const TableExprNode* node();
00098     static MSFieldParse* thisMSFParser;
00099     static Vector<Int> selectedIDs() {return idList;};
00100     static void reset();
00101     static void cleanup() 
00102     {if (node_p) delete node_p;node_p=0x0;}
00103     MSField& subTable() {return msFieldSubTable_p;}
00104   private:
00105     static TableExprNode* node_p;
00106     const String colName;
00107     static  Vector<Int> idList;
00108     MSField msFieldSubTable_p;
00109     static TableExprNode columnAsTEN_p;
00110   };
00111   
00112 } //# NAMESPACE CASA - END
00113 
00114 #endif
00115 
00116 
00117 //---------------------OLD CODE START (Feb. 2012)-------------------
00118 // #ifndef MS_MSFIELDPARSE_H
00119 // #define MS_MSFIELDPARSE_H
00120 
00121 // //# Includes
00122 // #include <ms/MeasurementSets/MSParse.h>
00123 // #include <ms/MeasurementSets/MSSelectionError.h>
00124 // #include <ms/MeasurementSets/MSSelectableTable.h>
00125 // namespace casa { //# NAMESPACE CASA - BEGIN
00126   
00127 //   //# Forward Declarations
00128   
00129   
00130 //   // <summary>
00131 //   // Class to hold values from field grammar parser
00132 //   // </summary>
00133   
00134 //   // <use visibility=local>
00135   
00136 //   // <reviewed reviewer="" date="" tests="">
00137 //   // </reviewed>
00138   
00139 //   // <prerequisite>
00140 //   //# Classes you should understand before using this one.
00141 //   // </prerequisite>
00142   
00143 //   // <etymology>
00144 //   // MSFieldParse is the class used to parse a field command.
00145 //   // </etymology>
00146   
00147 //   // <synopsis>
00148 //   // MSFieldParse is used by the parser of field sub-expression statements.
00149 //   // The parser is written in Bison and Flex in files MSFieldGram.y and .l.
00150 //   // The statements in there use the routines in this file to act
00151 //   // upon a reduced rule.
00152 //   // Since multiple tables can be given (with a shorthand), the table
00153 //   // names are stored in a list. The variable names can be qualified
00154 //   // by the table name and will be looked up in the appropriate table.
00155 //   //
00156 //   // The class MSFieldParse only contains information about a table
00157 //   // used in the table command. Global variables (like a list and a vector)
00158 //   // are used in MSFieldParse.cc to hold further information.
00159 //   //
00160 //   // Global functions are used to operate on the information.
00161 //   // The main function is the global function msFieldCommand.
00162 //   // It executes the given STaQL command and returns the resulting ms.
00163 //   // This is, in fact, the only function to be used by a user.
00164 //   // </synopsis>
00165   
00166 //   // <motivation>
00167 //   // It is necessary to be able to give a ms command in ASCII.
00168 //   // This can be used in a CLI or in the table browser to get a subset
00169 //   // of a table or to sort a table.
00170 //   // </motivation>
00171   
00172 //   //# <todo asof="$DATE:$">
00173 //   //# A List of bugs, limitations, extensions or planned refinements.
00174 //   //# </todo>
00175   
00176   
00177 //   class MSFieldParse : public MSParse
00178 //   {
00179     
00180 //   public:
00181 //     // Default constructor
00182 //     MSFieldParse ();
00183 //     //  ~MSFieldParse() {idList.resize(0);};
00184 //     // Associate the ms and the shorthand.
00185 //     MSFieldParse (const MeasurementSet* ms);
00186 //     MSFieldParse (MSSelectableTable* msLike);
00187 //     //~MSFieldParse() {if (node_p) delete node_p;node_p=0x0;};
00188     
00189 //     const TableExprNode *selectFieldIds(const Vector<Int>& fieldIds);
00190 //     //    const TableExprNode *selectFieldOrSource(const String& fieldName);
00191     
00192 //     // Get table expression node object.
00193 //     static const TableExprNode* node();
00194 //     static MSFieldParse* thisMSFParser;
00195 //     static Vector<Int> selectedIDs() {return idList;};
00196 //     static void reset();//{idList.resize(0);};
00197 //     static void cleanup() {if (node_p) delete node_p;node_p=0x0;}
00198 //   private:
00199 //     static TableExprNode* node_p;
00200 //     const String colName;
00201 //     static  Vector<Int> idList;
00202     
00203 //   };
00204   
00205 // } //# NAMESPACE CASA - END
00206 
00207 // #endif
00208 //---------------------OLD CODE END (Feb. 2012)-------------------