casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
MSFreqOffColumns.h
Go to the documentation of this file.
00001 //# MSFreqOffsetColumns.h: provides easy access to FREQ_OFFSET columns
00002 //# Copyright (C) 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: MSFreqOffColumns.h 19944 2007-02-27 11:14:34Z Malte.Marquarding $
00027 
00028 #ifndef MS_MSFREQOFFCOLUMNS_H
00029 #define MS_MSFREQOFFCOLUMNS_H
00030 
00031 #include <casa/aips.h>
00032 #include <measures/Measures/MEpoch.h>
00033 #include <measures/Measures/MCEpoch.h>
00034 #include <measures/TableMeasures/ScalarMeasColumn.h>
00035 #include <measures/TableMeasures/ScalarQuantColumn.h>
00036 #include <tables/Tables/ScalarColumn.h>
00037 
00038 namespace casa { //# NAMESPACE CASA - BEGIN
00039 
00040 class MSFreqOffset;
00041 
00042 // <summary>
00043 // A class to provide easy read-only access to MSFreqOffset columns
00044 // </summary>
00045 
00046 // <use visibility=export>
00047 
00048 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
00049 // </reviewed>
00050 
00051 // <prerequisite>
00052 //   <li> MSFreqOffset
00053 //   <li> ArrayColumn
00054 //   <li> ScalarColumn
00055 // </prerequisite>
00056 //
00057 // <etymology>
00058 // ROMSFreqOffsetColumns stands for Read-Only MeasurementSet FreqOffset
00059 // Table columns.
00060 // </etymology>
00061 //
00062 // <synopsis>
00063 // This class provides read-only access to the columns in the MSFreqOffset
00064 // Table.  It does the declaration of all the Scalar and ArrayColumns with the
00065 // correct types, so the application programmer doesn't have to worry about
00066 // getting those right. There is an access function for every predefined
00067 // column. Access to non-predefined columns will still have to be done with
00068 // explicit declarations.  See <linkto class=ROMSColumns>
00069 // ROMSColumns</linkto> for an example.
00070 
00071 // </synopsis>
00072 //
00073 // <motivation>
00074 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
00075 // </motivation>
00076 
00077 class ROMSFreqOffsetColumns
00078 {
00079 public:
00080   // Create a columns object that accesses the data in the specified Table
00081   ROMSFreqOffsetColumns(const MSFreqOffset& msFreqOffset);
00082   
00083   // The destructor does nothing special
00084   ~ROMSFreqOffsetColumns();
00085   
00086   // Is this object defined? (MSFreqOffset table is optional)
00087   Bool isNull() const {return isNull_p;}
00088   
00089   // Access to columns
00090   // <group>
00091   const ROScalarColumn<Int>& antenna1() const {return antenna1_p;}
00092   const ROScalarColumn<Int>& antenna2() const {return antenna2_p;}
00093   const ROScalarColumn<Int>& feedId() const {return feedId_p;}
00094   const ROScalarColumn<Double>& interval() const {return interval_p;}
00095   const ROScalarQuantColumn<Double>& intervalQuant() const {
00096     return intervalQuant_p;}
00097   const ROScalarColumn<Double>& offset() const {return offset_p;}
00098   const ROScalarQuantColumn<Double>& offsetQuant() const {
00099     return offsetQuant_p;}
00100   const ROScalarColumn<Int>& spectralWindowId() const {
00101     return spectralWindowId_p;}
00102   const ROScalarColumn<Double>& time() const {return time_p;}
00103   const ROScalarQuantColumn<Double>& timeQuant() const {return timeQuant_p;}
00104   const ROScalarMeasColumn<MEpoch>& timeMeas() const {return timeMeas_p;}
00105   // </group>
00106   
00107   // Convenience function that returns the number of rows in any of the
00108   // columns. Returns zero if the object is null.
00109   uInt nrow() const {return isNull() ? 0 : antenna1_p.nrow();}
00110 
00111 protected:
00112   //# default constructor creates a object that is not usable. Use the attach
00113   //# function correct this.
00114   ROMSFreqOffsetColumns();
00115 
00116   //# attach this object to the supplied table.
00117   void attach(const MSFreqOffset& msFreqOffset);
00118 
00119 private:
00120   //# Make the assignment operator and the copy constructor private to prevent
00121   //# any compiler generated one from being used.
00122   ROMSFreqOffsetColumns(const ROMSFreqOffsetColumns&);
00123   ROMSFreqOffsetColumns& operator=(const ROMSFreqOffsetColumns&);
00124 
00125   //# Is the object not attached to a Table.
00126   Bool isNull_p;
00127 
00128   //# required columns
00129   ROScalarColumn<Int> antenna1_p;
00130   ROScalarColumn<Int> antenna2_p;
00131   ROScalarColumn<Int> feedId_p;
00132   ROScalarColumn<Double> interval_p;
00133   ROScalarColumn<Double> offset_p;
00134   ROScalarColumn<Int> spectralWindowId_p;
00135   ROScalarColumn<Double> time_p;
00136 
00137   //# Access to Measure columns
00138   ROScalarMeasColumn<MEpoch> timeMeas_p;
00139 
00140   //# Access to Quantum columns
00141   ROScalarQuantColumn<Double> intervalQuant_p;
00142   ROScalarQuantColumn<Double> offsetQuant_p;
00143   ROScalarQuantColumn<Double> timeQuant_p;
00144 };
00145 
00146 // <summary>
00147 // A class to provide easy read-write access to MSFreqOffset 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> MSFreqOffset
00157 //   <li> ScalarColumn
00158 // </prerequisite>
00159 //
00160 // <etymology>
00161 // MSFreqOffsetColumns stands for MeasurementSet FreqOffset Table
00162 // columns.
00163 // </etymology>
00164 //
00165 // <synopsis>
00166 // This class provides access to the columns in the MSFreqOffset Table,
00167 // it does the declaration of all the Scalar and ArrayColumns with the
00168 // correct types, so the application programmer doesn't have to
00169 // worry about getting those right. There is an access function
00170 // for every predefined column. Access to non-predefined columns will still
00171 // have to be done with explicit declarations.
00172 // See <linkto class=MSColumns> MSColumns</linkto> for an example.
00173 // </synopsis>
00174 //
00175 // <motivation>
00176 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
00177 // </motivation>
00178 
00179 class MSFreqOffsetColumns: public ROMSFreqOffsetColumns
00180 {
00181 public:
00182   // Create a columns object that accesses the data in the specified Table
00183   MSFreqOffsetColumns(MSFreqOffset& msFreqOffset);
00184 
00185   // The destructor does nothing special
00186   ~MSFreqOffsetColumns();
00187   
00188   // Read-write access to required columns
00189   // <group>
00190   ScalarColumn<Int>& antenna1() {return antenna1_p;}
00191   ScalarColumn<Int>& antenna2() {return antenna2_p;}
00192   ScalarColumn<Int>& feedId() {return feedId_p;}
00193   ScalarColumn<Double>& interval() {return interval_p;}
00194   ScalarQuantColumn<Double>& intervalQuant() {return intervalQuant_p;}
00195   ScalarColumn<Double>& offset() {return offset_p;}
00196   ScalarQuantColumn<Double>& offsetQuant() {return offsetQuant_p;}
00197   ScalarColumn<Int>& spectralWindowId() {return spectralWindowId_p;}
00198   ScalarColumn<Double>& time() {return time_p;}
00199   ScalarQuantColumn<Double>& timeQuant() {return timeQuant_p;}
00200   ScalarMeasColumn<MEpoch>& timeMeas() {return timeMeas_p;}
00201   // </group>
00202 
00203   // Read-only access to required columns
00204   // <group>
00205   const ROScalarColumn<Int>& antenna1() const {
00206     return ROMSFreqOffsetColumns::antenna1();}
00207   const ROScalarColumn<Int>& antenna2() const {
00208     return ROMSFreqOffsetColumns::antenna2();}
00209   const ROScalarColumn<Int>& feedId() const {
00210     return ROMSFreqOffsetColumns::feedId();}
00211   const ROScalarColumn<Double>& interval() const {
00212     return ROMSFreqOffsetColumns::interval();}
00213   const ROScalarQuantColumn<Double>& intervalQuant() const {
00214     return ROMSFreqOffsetColumns::intervalQuant();}
00215   const ROScalarColumn<Double>& offset() const {
00216     return ROMSFreqOffsetColumns::offset();}
00217   const ROScalarQuantColumn<Double>& offsetQuant() const {
00218     return ROMSFreqOffsetColumns::offsetQuant();}
00219   const ROScalarColumn<Int>& spectralWindowId() const {
00220     return ROMSFreqOffsetColumns::spectralWindowId();}
00221   const ROScalarColumn<Double>& time() const {
00222     return ROMSFreqOffsetColumns::time();}
00223   const ROScalarQuantColumn<Double>& timeQuant() const {
00224     return ROMSFreqOffsetColumns::timeQuant();}
00225   const ROScalarMeasColumn<MEpoch>& timeMeas() const {
00226     return ROMSFreqOffsetColumns::timeMeas();}
00227   // </group>
00228   
00229   // set the epoch type for the TIME column.
00230   // <note role=tip>
00231   // In principle this function can only be used if the table is empty,
00232   // otherwise already written values may thereafter have an incorrect
00233   // reference, offset, or unit.  However, it is possible that part of the
00234   // table gets written before these values are known.  In that case the
00235   // reference, offset, or units can be set by using a False
00236   // <src>tableMustBeEmpty</src> argument.
00237   // </note>
00238   void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True);
00239 
00240 protected:
00241   //# default constructor creates a object that is not usable. Use the attach
00242   //# function correct this.
00243   MSFreqOffsetColumns();
00244 
00245   //# attach this object to the supplied table.
00246   void attach(MSFreqOffset& msFreqOffset);
00247 
00248 private:
00249   //# Make the assignment operator and the copy constructor private to prevent
00250   //# any compiler generated one from being used.
00251   MSFreqOffsetColumns(const MSFreqOffsetColumns&);
00252   MSFreqOffsetColumns& operator=(const MSFreqOffsetColumns&);
00253 
00254   //# required columns
00255   ScalarColumn<Int> antenna1_p;
00256   ScalarColumn<Int> antenna2_p;
00257   ScalarColumn<Int> feedId_p;
00258   ScalarColumn<Double> interval_p;
00259   ScalarColumn<Double> offset_p;
00260   ScalarColumn<Int> spectralWindowId_p;
00261   ScalarColumn<Double> time_p;
00262 
00263   //# Access to Measure columns
00264   ScalarMeasColumn<MEpoch> timeMeas_p;
00265 
00266   //# Access to Quantum columns
00267   ScalarQuantColumn<Double> intervalQuant_p;
00268   ScalarQuantColumn<Double> offsetQuant_p;
00269   ScalarQuantColumn<Double> timeQuant_p;
00270 };
00271 
00272 
00273 } //# NAMESPACE CASA - END
00274 
00275 #endif