casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
MSColumns.h
Go to the documentation of this file.
00001 //# MSColumns.h: provides easy access to MeasurementSet columns
00002 //# Copyright (C) 1996,1999,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 //# $Id: MSColumns.h 18093 2004-11-30 17:51:10Z ddebonis $
00027 
00028 #ifndef MS_MSCOLUMNS_H
00029 #define MS_MSCOLUMNS_H
00030 
00031 #include <casa/aips.h>
00032 #include <measures/Measures/MDirection.h>
00033 #include <measures/Measures/MEpoch.h>
00034 #include <ms/MeasurementSets/MSAntennaColumns.h>
00035 #include <ms/MeasurementSets/MSDataDescColumns.h>
00036 #include <ms/MeasurementSets/MSDopplerColumns.h>
00037 #include <ms/MeasurementSets/MSFeedColumns.h>
00038 #include <ms/MeasurementSets/MSFieldColumns.h>
00039 #include <ms/MeasurementSets/MSFlagCmdColumns.h>
00040 #include <ms/MeasurementSets/MSFreqOffColumns.h>
00041 #include <ms/MeasurementSets/MSHistoryColumns.h>
00042 #include <ms/MeasurementSets/MSMainColumns.h>
00043 #include <ms/MeasurementSets/MSObsColumns.h>
00044 #include <ms/MeasurementSets/MSPointingColumns.h>
00045 #include <ms/MeasurementSets/MSPolColumns.h>
00046 #include <ms/MeasurementSets/MSProcessorColumns.h>
00047 #include <ms/MeasurementSets/MSSourceColumns.h>
00048 #include <ms/MeasurementSets/MSSpWindowColumns.h>
00049 #include <ms/MeasurementSets/MSStateColumns.h>
00050 #include <ms/MeasurementSets/MSSysCalColumns.h>
00051 #include <ms/MeasurementSets/MSWeatherColumns.h>
00052 
00053 namespace casa { //# NAMESPACE CASA - BEGIN
00054 
00055 class MeasurementSet;
00056 
00057 // <summary>
00058 // A class to provide easy read-only access to MeasurementSet columns
00059 // </summary>
00060 
00061 // <use visibility=export>
00062 
00063 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
00064 // </reviewed>
00065 
00066 // <prerequisite>
00067 //   <li> MeasurementSet
00068 //   <li> ArrayColumn
00069 //   <li> ScalarColumn
00070 // </prerequisite>
00071 //
00072 // <etymology>
00073 // ROMSColumns stands for Read-Only MeasurementSet Table columns.
00074 // </etymology>
00075 //
00076 // <synopsis>
00077 // This class provides read-only access to the columns in the MeasurementSet.
00078 // It does the declaration of all the Scalar and ArrayColumns with the
00079 // correct types, so the application programmer doesn't have to
00080 // worry about getting those right. There is an access function
00081 // for every predefined column. Access to non-predefined columns will still
00082 // have to be done with explicit declarations.
00083 // </synopsis>
00084 //
00085 // <example>
00086 // <srcblock>
00087 // // use as follows
00088 // MeasurementSet ms("myMS"); 
00089 // ROMSColumns msc(ms);
00090 // // show data from row 5
00091 // cout << msc.data()(5);
00092 // // show name of antenna on row 3 in antenna table
00093 // cout << msc.antenna().name();
00094 // </srcblock>
00095 // </example>
00096 //
00097 // <motivation>
00098 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
00099 // </motivation>
00100 //
00101 // <todo asof="1997/02/01">
00102 //   <li> We might decide to merge all the MSColumn classes with the
00103 //        corresponding MeasurementSet classes.
00104 // </todo>
00105 
00106 class ROMSColumns: public ROMSMainColumns
00107 {
00108 public:
00109   // Create a columns object that accesses the data in the specified MS
00110   ROMSColumns(const MeasurementSet& ms);
00111 
00112   // The destructor does nothing special
00113   ~ROMSColumns();
00114 
00115   // Access to required subtables
00116   // <group>
00117   const ROMSAntennaColumns& antenna() const {return antenna_p;}
00118   const ROMSDataDescColumns& dataDescription() const {return dataDesc_p;}
00119   const ROMSFeedColumns& feed() const {return feed_p;}
00120   const ROMSFieldColumns& field() const {return field_p;}
00121   const ROMSFlagCmdColumns& flagCmd() const {return flagCmd_p;}
00122   const ROMSHistoryColumns& history() const {return history_p;}
00123   const ROMSObservationColumns& observation() const {return observation_p;}
00124   const ROMSPointingColumns& pointing() const {return pointing_p;}
00125   const ROMSPolarizationColumns& polarization() const {
00126     return polarization_p;}
00127   const ROMSProcessorColumns& processor() const {return processor_p;}
00128   const ROMSSpWindowColumns& spectralWindow() const {
00129     return spectralWindow_p;}
00130   const ROMSStateColumns& state() const {return state_p;}
00131   // </group>
00132 
00133   // Access to optional subtables
00134   // <group>
00135   const ROMSDopplerColumns& doppler() const {return doppler_p;}
00136   const ROMSFreqOffsetColumns& freqOffset() const {return freqOffset_p;}
00137   const ROMSSourceColumns& source() const {return source_p;}
00138   const ROMSSysCalColumns& sysCal() const {return sysCal_p;}
00139   const ROMSWeatherColumns& weather() const {return weather_p;}
00140   // </group>
00141 
00142 private:
00143   // Access to subtables
00144   ROMSAntennaColumns antenna_p;
00145   ROMSDataDescColumns dataDesc_p;
00146   ROMSDopplerColumns doppler_p; //optional
00147   ROMSFeedColumns feed_p;
00148   ROMSFieldColumns field_p;
00149   ROMSFlagCmdColumns flagCmd_p;
00150   ROMSFreqOffsetColumns freqOffset_p; //optional
00151   ROMSHistoryColumns history_p;
00152   ROMSObservationColumns observation_p;
00153   ROMSPointingColumns pointing_p;
00154   ROMSPolarizationColumns polarization_p;
00155   ROMSProcessorColumns processor_p;
00156   ROMSSourceColumns source_p; // optional
00157   ROMSSpWindowColumns spectralWindow_p;
00158   ROMSStateColumns state_p;
00159   ROMSSysCalColumns sysCal_p; //optional
00160   ROMSWeatherColumns weather_p; //optional
00161 };
00162 
00163 // <summary>
00164 // A class to provide easy read-write access to MeasurementSet columns
00165 // </summary>
00166 
00167 // <use visibility=export>
00168 
00169 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
00170 // </reviewed>
00171 
00172 // <prerequisite>
00173 //   <li> MeasurementSet
00174 //   <li> ArrayColumn
00175 //   <li> ScalarColumn
00176 // </prerequisite>
00177 //
00178 // <etymology>
00179 // MSColumns stands for MeasurementSet Table columns.
00180 // </etymology>
00181 //
00182 // <synopsis>
00183 // This class provides access to all the subtables and direct access to all the
00184 // columns in the MeasurementSet.  It does the declaration of all the Scalar
00185 // and ArrayColumns with the correct types, so the application programmer
00186 // doesn't have to worry about getting those right. There is an access function
00187 // for every predefined column. Access to non-predefined columns will still
00188 // have to be done with explicit declarations.
00189 // </synopsis>
00190 //
00191 // <example>
00192 // <srcblock>
00193 // // use as follows
00194 // MeasurementSet ms("myMS",Table::Update); 
00195 // MSColumns msc(ms);
00196 // // show data from row 5
00197 // cout << msc.data()(5);
00198 // // change name of antenna on row 3 in antenna table
00199 // msc.antenna().name().put(3,"NewAnt-3");
00200 // </srcblock>
00201 // </example>
00202 //
00203 // <motivation>
00204 // Having to type long lists of Scalar and Array column declarations gets
00205 // very tedious. This class attempts to relieve some of that tedium, while
00206 // at the same time concentrating all the declarations in one place,
00207 // making Type errors in the column declaration (only caught at run-time) less
00208 // probable. Type errors in the use of the columns is caught at compile
00209 // time.
00210 // </motivation>
00211 //
00212 // <todo asof="1997/02/01">
00213 //   <li> We might decide to merge this class with the MeasurementSet
00214 // </todo>
00215 
00216 class MSColumns: public MSMainColumns
00217 {
00218 public:
00219   // Create a columns object that accesses the data in the specified MS
00220   MSColumns(MeasurementSet& ms);
00221 
00222   // The destructor does nothing special
00223   ~MSColumns();
00224 
00225   // Read-write access to required subtables
00226   // <group>
00227   MSAntennaColumns& antenna() {return antenna_p;}
00228   MSDataDescColumns& dataDescription() {return dataDesc_p;}
00229   MSFeedColumns& feed() {return feed_p;}
00230   MSFieldColumns& field() {return field_p;}
00231   MSFlagCmdColumns& flagCmd() {return flagCmd_p;}
00232   MSHistoryColumns& history() {return history_p;}
00233   MSObservationColumns& observation() {return observation_p;}
00234   MSPointingColumns& pointing() {return pointing_p;}
00235   MSPolarizationColumns& polarization() {return polarization_p;}
00236   MSProcessorColumns& processor() {return processor_p;}
00237   MSSpWindowColumns& spectralWindow() {return spectralWindow_p;}
00238   MSStateColumns& state() {return state_p;}
00239   // </group>
00240 
00241   // Read-write access to optional subtables
00242   // <group>
00243   MSDopplerColumns& doppler() {return doppler_p;}
00244   MSFreqOffsetColumns& freqOffset() {return freqOffset_p;}
00245   MSSourceColumns& source() {return source_p;}
00246   MSSysCalColumns& sysCal() {return sysCal_p;}
00247   MSWeatherColumns& weather() {return weather_p;}
00248   // </group>
00249 
00250   // Read-only access to required subtables
00251   // <group>
00252   const ROMSAntennaColumns& antenna() const {return antenna_p;}
00253   const ROMSDataDescColumns& dataDescription() const {return dataDesc_p;}
00254   const ROMSFeedColumns& feed() const {return feed_p;}
00255   const ROMSFieldColumns& field() const {return field_p;}
00256   const ROMSFlagCmdColumns& flagCmd() const {return flagCmd_p;}
00257   const ROMSHistoryColumns& history() const {return history_p;}
00258   const ROMSObservationColumns& observation() const {return observation_p;}
00259   const ROMSPointingColumns& pointing() const {return pointing_p;}
00260   const ROMSPolarizationColumns& polarization() const {
00261     return polarization_p;}
00262   const ROMSProcessorColumns& processor() const {return processor_p;}
00263   const ROMSSourceColumns& source() const {return source_p;}
00264   const ROMSSpWindowColumns& spectralWindow() const {
00265     return spectralWindow_p;}
00266   const ROMSStateColumns& state() const {return state_p;}
00267   // </group>
00268 
00269   // Read-only access to optional subtables
00270   // <group>
00271   const ROMSDopplerColumns& doppler() const {return doppler_p;}
00272   const ROMSFreqOffsetColumns& freqOffset() const {return freqOffset_p;}
00273   const ROMSSysCalColumns& sysCal() const {return sysCal_p;}
00274   const ROMSWeatherColumns& weather() const {return weather_p;}
00275   // </group>
00276 
00277   // set the EPOCH reference type in all EPOCH columns in the MS. Note that
00278   // only a single EPOCH reference is allowed in the MS. This 
00279   // <note role=tip>
00280   // In principle this function can only be used if the table is empty,
00281   // otherwise already written values may thereafter have an incorrect
00282   // reference, offset, or unit.  However, it is possible that part of the
00283   // table gets written before these values are known.  In that case the
00284   // reference, offset, or units can be set by using a False
00285   // <src>tableMustBeEmpty</src> argument.
00286   // </note>
00287   void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True);
00288 
00289   // set the DIRECTION reference type for FIELD, POINTING and SOURCE tables
00290   // (except for antenna frame directions). 
00291   void setDirectionRef(MDirection::Types ref);
00292 
00293 private:
00294   // Access to subtables
00295   MSAntennaColumns antenna_p;
00296   MSDataDescColumns dataDesc_p;
00297   MSDopplerColumns doppler_p; //optional
00298   MSFeedColumns feed_p;
00299   MSFieldColumns field_p;
00300   MSFlagCmdColumns flagCmd_p;
00301   MSFreqOffsetColumns freqOffset_p; //optional
00302   MSHistoryColumns history_p;
00303   MSObservationColumns observation_p;
00304   MSPointingColumns pointing_p;
00305   MSPolarizationColumns polarization_p;
00306   MSProcessorColumns processor_p;
00307   MSSourceColumns source_p; // optional
00308   MSSpWindowColumns spectralWindow_p;
00309   MSStateColumns state_p;
00310   MSSysCalColumns sysCal_p; //optional
00311   MSWeatherColumns weather_p; //optional
00312 };
00313 
00314 } //# NAMESPACE CASA - END
00315 
00316 #endif
00317 
00318