casa
$Rev:20696$
|
00001 //# MSSpwParse.h: Classes to hold results from spw 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: MSSpwParse.h 20652 2009-07-06 05:04:32Z Malte.Marquarding $ 00027 00028 #ifndef MS_MSSPWPARSE_H 00029 #define MS_MSSPWPARSE_H 00030 00031 //# Includes 00032 #include <ms/MeasurementSets/MSParse.h> 00033 #include <casa/Arrays/Matrix.h> 00034 00035 namespace casa { //# NAMESPACE CASA - BEGIN 00036 00037 //# Forward Declarations 00038 00039 00040 // <summary> 00041 // Class to hold values from field 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 // MSSpwParse is the class used to parse a spectral window selection command. 00055 // </etymology> 00056 00057 // <synopsis> MSSpwParse is used by the parser of spectral window 00058 // (Spw) sub-expression statements. The parser is written in Bison 00059 // and Flex in files MSSpwGram.y and .l. The statements in there use 00060 // the routines in this file to act upon a reduced rule. Since 00061 // multiple tables can be given (with a shorthand), the table names 00062 // are stored in a list. The variable names can be qualified by the 00063 // table name and will be looked up in the appropriate table. 00064 // 00065 // The class MSSpwParse only contains information about a table 00066 // used in the table command. Global variables (like a list and a vector) 00067 // are used in MSSpwParse.cc to hold further information. 00068 // 00069 // Global functions are used to operate on the information. 00070 // The main function is the global function msSpwCommand. 00071 // It executes the given STaQL command and returns the resulting ms. 00072 // This is, in fact, the only function to be used by a user. 00073 // </synopsis> 00074 00075 // <motivation> 00076 // It is necessary to be able to give a ms command in ASCII. 00077 // This can be used in a CLI or in the table browser to get a subset 00078 // of a table or to sort a table. 00079 // </motivation> 00080 00081 //# <todo asof="$DATE:$"> 00082 //# A List of bugs, limitations, extensions or planned refinements. 00083 //# </todo> 00084 00085 00086 class MSSpwParse : public MSParse 00087 { 00088 public: 00089 // Default constructor 00090 MSSpwParse (); 00091 // ~MSSpwParse() {if (node_p) delete node_p;node_p=0x0;}; 00092 00093 // Associate the ms and the shorthand. 00094 MSSpwParse (const MeasurementSet* ms); 00095 MSSpwParse (const MSSpectralWindow& spwSubTable, const MSDataDescription& ddSubTable, 00096 const TableExprNode& columnAsTEN); 00097 ~MSSpwParse() {columnAsTEN_p=TableExprNode();}; 00098 00099 const TableExprNode *selectSpwIdsFromIDList(const Vector<Int>& spwIds, 00100 const Bool addTen=True, 00101 const Bool addIDs=True); 00102 const TableExprNode *selectSpwIdsFromFreqList(const Vector<Float>& spwIds, 00103 const Float factor); 00104 void selectChannelsFromIDList(Vector<Int>& spwIds, 00105 Vector<Int>& chanIDList, 00106 Int nFSpec); 00107 00108 void selectChannelsFromDefaultList(Vector<Int>& spwIds, 00109 Vector<Int>& chanDefaultList); 00110 const TableExprNode* endOfCeremony(const TableExprNode& ten); 00111 00112 // const TableExprNode *selectSpwOrSource(const String& fieldName); 00113 00114 // Get table expression node object. 00115 static const TableExprNode* node(); 00116 static MSSpwParse* thisMSSParser; 00117 static Vector<Int> selectedIDs() {return idList;} 00118 static Matrix<Int> selectedChanIDs() {return chanList;} 00119 static void reset() {idList.resize(0);chanList.resize(0,0);}; 00120 static void cleanup() {if (node_p) delete node_p;node_p=0x0;}; 00121 00122 MSSpectralWindow& subTable() {return spwSubTable_p;} 00123 private: 00124 static TableExprNode* node_p; 00125 static Vector<Int> idList; 00126 static Matrix<Int> chanList; 00127 MSSpectralWindow spwSubTable_p; 00128 MSDataDescription ddSubTable_p; 00129 static TableExprNode columnAsTEN_p; 00130 }; 00131 00132 } //# NAMESPACE CASA - END 00133 00134 #endif