MSObsColumns.h

Go to the documentation of this file.
00001 //# MSObservationColumns.h: provides easy access to MSObservation 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$
00027 
00028 #ifndef MS_MSOBSCOLUMNS_H
00029 #define MS_MSOBSCOLUMNS_H
00030 
00031 #include <casa/aips.h>
00032 #include <measures/Measures/MEpoch.h>
00033 #include <measures/TableMeasures/ArrayMeasColumn.h>
00034 #include <measures/TableMeasures/ArrayQuantColumn.h>
00035 #include <measures/TableMeasures/ScalarMeasColumn.h>
00036 #include <measures/TableMeasures/ScalarQuantColumn.h>
00037 #include <tables/Tables/ArrayColumn.h>
00038 #include <tables/Tables/ScalarColumn.h>
00039 #include <casa/BasicSL/String.h>
00040 
00041 namespace casa { //# NAMESPACE CASA - BEGIN
00042 
00043 class MSObservation;
00044 
00045 // <summary>
00046 // A class to provide easy read-only access to MSObservation columns
00047 // </summary>
00048 
00049 // <use visibility=export>
00050 
00051 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
00052 // </reviewed>
00053 
00054 // <prerequisite>
00055 //   <li> MSObservation
00056 //   <li> ArrayColumn
00057 //   <li> ScalarColumn
00058 // </prerequisite>
00059 //
00060 // <etymology>
00061 // ROMSObservationColumns stands for Read-Only MeasurementSet Observation
00062 // Table columns.
00063 // </etymology>
00064 //
00065 // <synopsis>
00066 // This class provides read-only access to the columns in the MSObservation
00067 // Table.  It does the declaration of all the Scalar and ArrayColumns with the
00068 // correct types, so the application programmer doesn't have to worry about
00069 // getting those right. There is an access function for every predefined
00070 // column. Access to non-predefined columns will still have to be done with
00071 // explicit declarations.  See <linkto class=ROMSColumns>
00072 // ROMSColumns</linkto> for an example.
00073 // </synopsis>
00074 //
00075 // <motivation>
00076 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
00077 // </motivation>
00078 
00079 class ROMSObservationColumns
00080 {
00081 public:
00082   // Create a columns object that accesses the data in the specified Table
00083   ROMSObservationColumns(const MSObservation& msObservation);
00084 
00085   // The destructor does nothing special
00086   ~ROMSObservationColumns();
00087 
00088   // Access to required columns
00089   // <group>
00090   const ROScalarColumn<Bool>& flagRow() const {return flagRow_p;}
00091   const ROArrayColumn<String>& log() const {return log_p;}
00092   const ROScalarColumn<String>& observer() const {return observer_p;}
00093   const ROScalarColumn<String>& project() const {return project_p;}
00094   const ROScalarColumn<Double>& releaseDate() const {return releaseDate_p;}
00095   const ROScalarQuantColumn<Double>& releaseDateQuant() const {
00096     return releaseDateQuant_p;}
00097   const ROScalarMeasColumn<MEpoch>& releaseDateMeas() const {
00098     return releaseDateMeas_p;}
00099   const ROArrayColumn<String>& schedule() const {return schedule_p;}
00100   const ROScalarColumn<String>& scheduleType() const {return scheduleType_p;}
00101   const ROScalarColumn<String>& telescopeName() const {return telescopeName_p;}
00102   const ROArrayColumn<Double>& timeRange() const {return timeRange_p;}
00103   const ROArrayQuantColumn<Double>& timeRangeQuant() const {
00104     return timeRangeQuant_p;}
00105   const ROArrayMeasColumn<MEpoch>& timeRangeMeas() const {
00106     return timeRangeMeas_p;}
00107   // </group>
00108 
00109   // Convenience function that returns the number of rows in any of the columns
00110   uInt nrow() const {return flagRow_p.nrow();}
00111 
00112 protected:
00113   //# default constructor creates a object that is not usable. Use the attach
00114   //# function correct this.
00115   ROMSObservationColumns();
00116 
00117   //# attach this object to the supplied table.
00118   void attach(const MSObservation& msObservation);
00119 
00120 private:
00121   //# Make the assignment operator and the copy constructor private to prevent
00122   //# any compiler generated one from being used.
00123   ROMSObservationColumns(const ROMSObservationColumns&);
00124   ROMSObservationColumns& operator=(const ROMSObservationColumns&);
00125 
00126   //# required columns
00127   ROScalarColumn<Bool> flagRow_p;
00128   ROArrayColumn<String> log_p;
00129   ROScalarColumn<String> observer_p;
00130   ROScalarColumn<String> project_p;
00131   ROScalarColumn<Double> releaseDate_p;
00132   ROArrayColumn<String> schedule_p;
00133   ROScalarColumn<String> scheduleType_p;
00134   ROScalarColumn<String> telescopeName_p;
00135   ROArrayColumn<Double> timeRange_p;
00136 
00137   //# Access to Measure columns
00138   ROScalarMeasColumn<MEpoch> releaseDateMeas_p;
00139   ROArrayMeasColumn<MEpoch> timeRangeMeas_p;
00140 
00141   //# Access to Quantum columns
00142   ROScalarQuantColumn<Double> releaseDateQuant_p;
00143   ROArrayQuantColumn<Double> timeRangeQuant_p;
00144 };
00145 
00146 // <summary>
00147 // A class to provide easy read-write access to MSObservation columns
00148 // </summary>
00149 
00150 // <use visibility=export>
00151 
00152 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
00153 // </reviewed>
00154 
00155 // <prerequisite>
00156 //   <li> MSObservation
00157 //   <li> ArrayColumn
00158 //   <li> ScalarColumn
00159 // </prerequisite>
00160 //
00161 // <etymology>
00162 // MSObservationColumns stands for MeasurementSet Observation Table
00163 // columns.
00164 // </etymology>
00165 //
00166 // <synopsis>
00167 // This class provides access to the columns in the MSObservation Table,
00168 // it does the declaration of all the Scalar and ArrayColumns with the
00169 // correct types, so the application programmer doesn't have to
00170 // worry about getting those right. There is an access function
00171 // for every predefined column. Access to non-predefined columns will still
00172 // have to be done with explicit declarations.
00173 // See <linkto class=MSColumns> MSColumns</linkto> for an example.
00174 // </synopsis>
00175 //
00176 // <motivation>
00177 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
00178 // </motivation>
00179 
00180 class MSObservationColumns: public ROMSObservationColumns
00181 {
00182 public:
00183   // Create a columns object that accesses the data in the specified Table
00184   MSObservationColumns(MSObservation& msObservation);
00185 
00186   // The desctructor does nothing special
00187   ~MSObservationColumns();
00188 
00189   // Read-write access to required columns
00190   // <group>
00191   ScalarColumn<Bool>& flagRow() {return flagRow_p;}
00192   ArrayColumn<String>& log() {return log_p;}
00193   ScalarColumn<String>& observer() {return observer_p;}
00194   ScalarColumn<String>& project() {return project_p;}
00195   ScalarColumn<Double>& releaseDate() {return releaseDate_p;}
00196   ScalarQuantColumn<Double>& releaseDateQuant() {return releaseDateQuant_p;}
00197   ScalarMeasColumn<MEpoch>& releaseDateMeas() {return releaseDateMeas_p;}
00198   ArrayColumn<String>& schedule() {return schedule_p;}
00199   ScalarColumn<String>& scheduleType() {return scheduleType_p;}
00200   ScalarColumn<String>& telescopeName() {return telescopeName_p;}
00201   ArrayColumn<Double>& timeRange() {return timeRange_p;}
00202   ArrayQuantColumn<Double>& timeRangeQuant() {return timeRangeQuant_p;}
00203   ArrayMeasColumn<MEpoch>& timeRangeMeas() {return timeRangeMeas_p;}
00204   // </group>
00205 
00206   // Read-only access to required columns
00207   // <group>
00208   const ROScalarColumn<Bool>& flagRow() const {
00209     return ROMSObservationColumns::flagRow();}
00210   const ROArrayColumn<String>& log() const {
00211     return ROMSObservationColumns::log();}
00212   const ROScalarColumn<String>& observer() const {
00213     return ROMSObservationColumns::observer();}
00214   const ROScalarColumn<String>& project() const {
00215     return ROMSObservationColumns::project();}
00216   const ROScalarColumn<Double>& releaseDate() const {
00217     return ROMSObservationColumns::releaseDate();}
00218   const ROScalarQuantColumn<Double>& releaseDateQuant() const {
00219     return ROMSObservationColumns::releaseDateQuant();}
00220   const ROScalarMeasColumn<MEpoch>& releaseDateMeas() const {
00221     return ROMSObservationColumns::releaseDateMeas();}
00222   const ROArrayColumn<String>& schedule() const {
00223     return ROMSObservationColumns::schedule();}
00224   const ROScalarColumn<String>& scheduleType() const {
00225     return ROMSObservationColumns::scheduleType();}
00226   const ROScalarColumn<String>& telescopeName() const {
00227     return ROMSObservationColumns::telescopeName();}
00228   const ROArrayColumn<Double>& timeRange() const {
00229     return ROMSObservationColumns::timeRange();}
00230   const ROArrayQuantColumn<Double>& timeRangeQuant() const {
00231     return ROMSObservationColumns::timeRangeQuant();}
00232   const ROArrayMeasColumn<MEpoch>& timeRangeMeas() const {
00233     return ROMSObservationColumns::timeRangeMeas();}
00234   // </group>
00235 
00236   // set the epoch type for the TIME_RANGE & RELEASE_DATE columns.
00237   // <note role=tip>
00238   // In principle this function can only be used if the table is empty,
00239   // otherwise already written values may thereafter have an incorrect
00240   // reference, offset, or unit.  However, it is possible that part of the
00241   // table gets written before these values are known.  In that case the
00242   // reference, offset, or units can be set by using a False
00243   // <src>tableMustBeEmpty</src> argument.
00244   // </note>
00245   void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True);
00246 
00247 protected:
00248   //# default constructor creates a object that is not usable. Use the attach
00249   //# function correct this.
00250   MSObservationColumns();
00251 
00252   //# attach this object to the supplied table.
00253   void attach(MSObservation& msObservation);
00254 
00255 private:
00256   //# Make the assignment operator and the copy constructor private to prevent
00257   //# any compiler generated one from being used.
00258   MSObservationColumns(const MSObservationColumns&);
00259   MSObservationColumns& operator=(const MSObservationColumns&);
00260 
00261   //# required columns
00262   ScalarColumn<Bool> flagRow_p;
00263   ArrayColumn<String> log_p;
00264   ScalarColumn<String> observer_p;
00265   ScalarColumn<String> project_p;
00266   ScalarColumn<Double> releaseDate_p;
00267   ArrayColumn<String> schedule_p;
00268   ScalarColumn<String> scheduleType_p;
00269   ScalarColumn<String> telescopeName_p;
00270   ArrayColumn<Double> timeRange_p;
00271 
00272   //# Access to Measure columns
00273   ScalarMeasColumn<MEpoch> releaseDateMeas_p;
00274   ArrayMeasColumn<MEpoch> timeRangeMeas_p;
00275 
00276   //# Access to Quantum columns
00277   ScalarQuantColumn<Double> releaseDateQuant_p;
00278   ArrayQuantColumn<Double> timeRangeQuant_p;
00279 };
00280 
00281 } //# NAMESPACE CASA - END
00282 
00283 #endif

Generated on Mon Sep 1 22:35:09 2008 for NRAOCASA by  doxygen 1.5.1