casa
$Rev:20696$
|
00001 //# MSReader.h: read from a MS, coordinating all of the subtables 00002 //# Copyright (C) 2000 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 //# 00027 //# $Id: MSReader.h 20652 2009-07-06 05:04:32Z Malte.Marquarding $ 00028 00029 #ifndef MS_MSREADER_H 00030 #define MS_MSREADER_H 00031 00032 #include <casa/aips.h> 00033 #include <casa/Arrays/Vector.h> 00034 #include <casa/Containers/Block.h> 00035 #include <casa/Containers/Record.h> 00036 #include <casa/Containers/SimOrdMap.h> 00037 #include <ms/MeasurementSets/MeasurementSet.h> 00038 #include <ms/MeasurementSets/MSColumns.h> 00039 #include <ms/MeasurementSets/MSDopplerIndex.h> 00040 #include <ms/MeasurementSets/MSFeedIndex.h> 00041 #include <ms/MeasurementSets/MSFreqOffIndex.h> 00042 #include <ms/MeasurementSets/MSPointingIndex.h> 00043 #include <ms/MeasurementSets/MSSourceIndex.h> 00044 #include <ms/MeasurementSets/MSSysCalIndex.h> 00045 #include <ms/MeasurementSets/MSTableIndex.h> 00046 #include <ms/MeasurementSets/MSWeatherIndex.h> 00047 #include <ms/MeasurementSets/MSValidIds.h> 00048 #include <tables/Tables/TableRow.h> 00049 #include <casa/Quanta/Unit.h> 00050 #include <casa/BasicSL/String.h> 00051 00052 namespace casa { //# NAMESPACE CASA - BEGIN 00053 00054 // <summary> 00055 // Read from an MS, coordinating all of the subtables in the process 00056 // </summary> 00057 00058 // <use visibility=local> 00059 00060 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00061 // </reviewed> 00062 class MSReader 00063 { 00064 public: 00065 // Attach to the indicated MeasurementSet 00066 MSReader(const MeasurementSet &ms); 00067 00068 ~MSReader() {;} 00069 00070 // Go to the indicated row in the MAIN table of the MS and point 00071 // at all of the appropriate rows in each of the subtables as 00072 // a result of going to this row. 00073 void gotoRow(uInt which); 00074 00075 const Vector<String> &tables() const {return itsTableNames;} 00076 00077 // Return the current row in the named table. Use rowNumber to 00078 // check to see that the most recent gotoRow actually found a matching 00079 // row. 00080 const RecordInterface &tableRow(const String &name) const; 00081 00082 // Return the current row number in the named table. This returns 00083 // -1 if that table has no row as a result of the most recent gotoRow. 00084 Int rowNumber(const String &name) const; 00085 00086 // Return a reference to the MS 00087 const MeasurementSet &ms() const {return itsMS;} 00088 00089 // Return a reference to the named subtable 00090 const Table &table(const String &name) const; 00091 00092 // this isn't what we need, right now just return an empty record 00093 const Record &units(const String &) const { return emptyRecord;} 00094 private: 00095 MeasurementSet itsMS; 00096 ROMSColumns itsMSCols; 00097 00098 // This possibly saves some time, Units of seconds 00099 Unit itsSecUnit; 00100 00101 MSValidIds itsIds; 00102 00103 // this maps table name to an index used throughout this class 00104 SimpleOrderedMap<String, Int> itsTabId; 00105 00106 // the indexes for the NS subtables 00107 Block<MSTableIndex> itsIndexes; 00108 00109 // specific indexes 00110 MSDopplerIndex itsDopplerIndex; 00111 MSFeedIndex itsFeed1Index; 00112 MSFeedIndex itsFeed2Index; 00113 MSFreqOffIndex itsFreqOffIndex; 00114 MSPointingIndex itsPointing1Index; 00115 MSPointingIndex itsPointing2Index; 00116 MSSourceIndex itsSourceIndex; 00117 MSSysCalIndex itsSyscal1Index; 00118 MSSysCalIndex itsSyscal2Index; 00119 MSWeatherIndex itsWeather1Index; 00120 MSWeatherIndex itsWeather2Index; 00121 00122 // table IDs for the standard tables 00123 Int itsMainId, itsAnt1Id, itsAnt2Id, itsDDId, itsDopplerId, itsFeed1Id, itsFeed2Id, itsFieldId, 00124 itsFlagCmdId, itsFreqOffsetId, itsObsId, itsPointing1Id, itsPointing2Id, itsPolId, itsProcId, 00125 itsSourceId, itsSpwId, itsStateId, itsSyscal1Id, itsSyscal2Id, itsWeather1Id, itsWeather2Id; 00126 // the table rows 00127 Block<ROTableRow> itsTabRows; 00128 00129 // What row number for each table is the most recent gotoRow call. Set to 00130 // -1 if there was no matching row as a result of that call. 00131 Block<Int> itsRowNumbers; 00132 00133 // this empty record is returned by tableRow when the name argument does not exist 00134 Record emptyRecord; 00135 00136 // this empty table is returned by table when the name argument does not exist 00137 Table emptyTable; 00138 00139 Vector<String> itsTableNames; 00140 00141 // undefined and unavailable 00142 MSReader(); 00143 MSReader(const MSReader &); 00144 MSReader& operator=(const MSReader &); 00145 }; 00146 00147 00148 } //# NAMESPACE CASA - END 00149 00150 #endif 00151