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