casa
$Rev:20696$
|
00001 //# MSWeatherColumns.h: provides easy access to MSWeather 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: MSWeatherColumns.h 19944 2007-02-27 11:14:34Z Malte.Marquarding $ 00027 00028 #ifndef MS_MSWEATHERCOLUMNS_H 00029 #define MS_MSWEATHERCOLUMNS_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 MSWeather; 00041 00042 // <summary> 00043 // A class to provide easy read-only access to MSWeather 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> MSWeather 00053 // <li> ArrayColumn 00054 // <li> ScalarColumn 00055 // </prerequisite> 00056 // 00057 // <etymology> 00058 // ROMSWeatherColumns stands for Read-Only MeasurementSet Weather Table 00059 // columns. 00060 // </etymology> 00061 // 00062 // <synopsis> 00063 // This class provides read-only access to the columns in the MSWeather 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 // </synopsis> 00071 // 00072 // <motivation> 00073 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation. 00074 // </motivation> 00075 00076 class ROMSWeatherColumns 00077 { 00078 public: 00079 // Create a columns object that accesses the data in the specified Table 00080 ROMSWeatherColumns(const MSWeather& msWeather); 00081 00082 // The destructor does nothing special 00083 ~ROMSWeatherColumns(); 00084 00085 // Is this object defined? (MSWeather table is optional) 00086 Bool isNull() const {return isNull_p;} 00087 00088 // Access to columns 00089 // <group> 00090 const ROScalarColumn<Int>& antennaId() const {return antennaId_p;} 00091 const ROScalarColumn<Double>& interval() const {return interval_p;} 00092 const ROScalarQuantColumn<Double>& intervalQuant() const { 00093 return intervalQuant_p;} 00094 const ROScalarColumn<Double>& time() const {return time_p;} 00095 const ROScalarQuantColumn<Double>& timeQuant() const {return timeQuant_p;} 00096 const ROScalarMeasColumn<MEpoch>& timeMeas() const {return timeMeas_p;} 00097 // </group> 00098 00099 // Access to optional columns 00100 // <group> 00101 const ROScalarColumn<Float>& dewPoint() const {return dewPoint_p;} 00102 const ROScalarQuantColumn<Float>& dewPointQuant() const { 00103 return dewPointQuant_p;} 00104 const ROScalarColumn<Bool>& dewPointFlag() const {return dewPointFlag_p;} 00105 const ROScalarColumn<Float>& H2O() const {return H2O_p;} 00106 const ROScalarColumn<Bool>& H2OFlag() const {return H2OFlag_p;} 00107 const ROScalarQuantColumn<Float>& H2OQuant() const {return H2OQuant_p;} 00108 const ROScalarColumn<Float>& ionosElectron() const {return ionosElectron_p;} 00109 const ROScalarQuantColumn<Float>& ionosElectronQuant() const { 00110 return ionosElectronQuant_p;} 00111 const ROScalarColumn<Bool>& ionosElectronFlag() const { 00112 return ionosElectronFlag_p;} 00113 const ROScalarColumn<Float>& pressure() const {return pressure_p;} 00114 const ROScalarQuantColumn<Float>& pressureQuant() const { 00115 return pressureQuant_p;} 00116 const ROScalarColumn<Bool>& pressureFlag() const {return pressureFlag_p;} 00117 const ROScalarColumn<Float>& relHumidity() const {return relHumidity_p;} 00118 const ROScalarColumn<Bool>& relHumidityFlag() const { 00119 return relHumidityFlag_p;} 00120 const ROScalarColumn<Float>& temperature() const {return temperature_p;} 00121 const ROScalarQuantColumn<Float>& temperatureQuant() const { 00122 return temperatureQuant_p;} 00123 const ROScalarColumn<Bool>& temperatureFlag() const { 00124 return temperatureFlag_p;} 00125 const ROScalarColumn<Float>& windDirection() const {return windDirection_p;} 00126 const ROScalarQuantColumn<Float>& windDirectionQuant() const { 00127 return windDirectionQuant_p;} 00128 const ROScalarColumn<Bool>& windDirectionFlag() const { 00129 return windDirectionFlag_p;} 00130 const ROScalarColumn<Float>& windSpeed() const {return windSpeed_p;} 00131 const ROScalarQuantColumn<Float>& windSpeedQuant() const { 00132 return windSpeedQuant_p;} 00133 const ROScalarColumn<Bool>& windSpeedFlag() const {return windSpeedFlag_p;} 00134 // </group> 00135 00136 // Convenience function that returns the number of rows in any of the 00137 // columns. Returns zero if the object is null. 00138 uInt nrow() const {return isNull() ? 0 : antennaId_p.nrow();} 00139 00140 protected: 00141 //# default constructor creates a object that is not usable. Use the attach 00142 //# function correct this. 00143 ROMSWeatherColumns(); 00144 00145 //# attach this object to the supplied table. 00146 void attach(const MSWeather& msWeather); 00147 00148 private: 00149 //# Make the assignment operator and the copy constructor private to prevent 00150 //# any compiler generated one from being used. 00151 ROMSWeatherColumns(const ROMSWeatherColumns&); 00152 ROMSWeatherColumns& operator=(const ROMSWeatherColumns&); 00153 00154 //# Check if any optional columns exist and if so attach them. 00155 void attachOptionalCols(const MSWeather& msWeather); 00156 00157 //# Is the object not attached to a Table. 00158 Bool isNull_p; 00159 00160 //# required columns 00161 ROScalarColumn<Int> antennaId_p; 00162 ROScalarColumn<Double> interval_p; 00163 ROScalarColumn<Double> time_p; 00164 //# optional columns 00165 ROScalarColumn<Float> dewPoint_p; 00166 ROScalarColumn<Bool> dewPointFlag_p; 00167 ROScalarColumn<Float> H2O_p; 00168 ROScalarColumn<Bool> H2OFlag_p; 00169 ROScalarColumn<Float> ionosElectron_p; 00170 ROScalarColumn<Bool> ionosElectronFlag_p; 00171 ROScalarColumn<Float> pressure_p; 00172 ROScalarColumn<Bool> pressureFlag_p; 00173 ROScalarColumn<Float> relHumidity_p; 00174 ROScalarColumn<Bool> relHumidityFlag_p; 00175 ROScalarColumn<Float> temperature_p; 00176 ROScalarColumn<Bool> temperatureFlag_p; 00177 ROScalarColumn<Float> windDirection_p; 00178 ROScalarColumn<Bool> windDirectionFlag_p; 00179 ROScalarColumn<Float> windSpeed_p; 00180 ROScalarColumn<Bool> windSpeedFlag_p; 00181 00182 //# Access to Measure columns 00183 ROScalarMeasColumn<MEpoch> timeMeas_p; 00184 00185 //# Access to Quantum columns 00186 ROScalarQuantColumn<Double> intervalQuant_p; 00187 ROScalarQuantColumn<Double> timeQuant_p; 00188 //# optional Quantum columns 00189 ROScalarQuantColumn<Float> dewPointQuant_p; 00190 ROScalarQuantColumn<Float> H2OQuant_p; 00191 ROScalarQuantColumn<Float> ionosElectronQuant_p; 00192 ROScalarQuantColumn<Float> pressureQuant_p; 00193 ROScalarQuantColumn<Float> temperatureQuant_p; 00194 ROScalarQuantColumn<Float> windDirectionQuant_p; 00195 ROScalarQuantColumn<Float> windSpeedQuant_p; 00196 }; 00197 00198 // <summary> 00199 // A class to provide easy read-write access to MSWeather columns 00200 // </summary> 00201 00202 // <use visibility=export> 00203 00204 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos=""> 00205 // </reviewed> 00206 00207 // <prerequisite> 00208 // <li> MSWeather 00209 // <li> ArrayColumn 00210 // <li> ScalarColumn 00211 // </prerequisite> 00212 // 00213 // <etymology> 00214 // MSWeatherColumns stands for MeasurementSet Weather Table columns. 00215 // </etymology> 00216 // 00217 // <synopsis> 00218 // This class provides access to the columns in the MSWeather Table, 00219 // it does the declaration of all the Scalar and ArrayColumns with the 00220 // correct types, so the application programmer doesn't have to 00221 // worry about getting those right. There is an access function 00222 // for every predefined column. Access to non-predefined columns will still 00223 // have to be done with explicit declarations. 00224 // See <linkto class=MSColumns> MSColumns</linkto> for an example. 00225 // </synopsis> 00226 // 00227 // <motivation> 00228 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation. 00229 // </motivation> 00230 00231 class MSWeatherColumns: public ROMSWeatherColumns 00232 { 00233 public: 00234 // Create a columns object that accesses the data in the specified Table 00235 MSWeatherColumns(MSWeather& msWeather); 00236 00237 // The destructor does nothing special 00238 ~MSWeatherColumns(); 00239 00240 // Read-write access to required columns 00241 // <group> 00242 ScalarColumn<Int>& antennaId() {return antennaId_p;} 00243 ScalarColumn<Double>& interval() {return interval_p;} 00244 ScalarQuantColumn<Double>& intervalQuant() {return intervalQuant_p;} 00245 ScalarColumn<Double>& time() {return time_p;} 00246 ScalarQuantColumn<Double>& timeQuant() {return timeQuant_p;} 00247 ScalarMeasColumn<MEpoch>& timeMeas() {return timeMeas_p;} 00248 // </group> 00249 00250 // Read-write access to optional columns 00251 // <group> 00252 ScalarColumn<Float>& dewPoint() {return dewPoint_p;} 00253 ScalarQuantColumn<Float>& dewPointQuant() {return dewPointQuant_p;} 00254 ScalarColumn<Bool>& dewPointFlag() {return dewPointFlag_p;} 00255 ScalarColumn<Float>& H2O() {return H2O_p;} 00256 ScalarQuantColumn<Float>& H2OQuant() {return H2OQuant_p;} 00257 ScalarColumn<Bool>& H2OFlag() {return H2OFlag_p;} 00258 ScalarColumn<Float>& ionosElectron() {return ionosElectron_p;} 00259 ScalarQuantColumn<Float>& ionosElectronQuant() {return ionosElectronQuant_p;} 00260 ScalarColumn<Bool>& ionosElectronFlag() {return ionosElectronFlag_p;} 00261 ScalarColumn<Float>& pressure() {return pressure_p;} 00262 ScalarQuantColumn<Float>& pressureQuant() {return pressureQuant_p;} 00263 ScalarColumn<Bool>& pressureFlag() {return pressureFlag_p;} 00264 ScalarColumn<Float>& relHumidity() {return relHumidity_p;} 00265 ScalarColumn<Bool>& relHumidityFlag() {return relHumidityFlag_p;} 00266 ScalarColumn<Float>& temperature() {return temperature_p;} 00267 ScalarQuantColumn<Float>& temperatureQuant() {return temperatureQuant_p;} 00268 ScalarColumn<Bool>& temperatureFlag() {return temperatureFlag_p;} 00269 ScalarColumn<Float>& windDirection() {return windDirection_p;} 00270 ScalarQuantColumn<Float>& windDirectionQuant() {return windDirectionQuant_p;} 00271 ScalarColumn<Bool>& windDirectionFlag() {return windDirectionFlag_p;} 00272 ScalarColumn<Float>& windSpeed() {return windSpeed_p;} 00273 ScalarQuantColumn<Float>& windSpeedQuant() {return windSpeedQuant_p;} 00274 ScalarColumn<Bool>& windSpeedFlag() {return windSpeedFlag_p;} 00275 // </group> 00276 00277 // Read-only access to required columns 00278 // <group> 00279 const ROScalarColumn<Int>& antennaId() const { 00280 return ROMSWeatherColumns::antennaId();} 00281 const ROScalarColumn<Double>& interval() const { 00282 return ROMSWeatherColumns::interval();} 00283 const ROScalarQuantColumn<Double>& intervalQuant() const { 00284 return ROMSWeatherColumns::intervalQuant();} 00285 const ROScalarColumn<Double>& time() const { 00286 return ROMSWeatherColumns::time();} 00287 const ROScalarQuantColumn<Double>& timeQuant() const { 00288 return ROMSWeatherColumns::timeQuant();} 00289 const ROScalarMeasColumn<MEpoch>& timeMeas() const { 00290 return ROMSWeatherColumns::timeMeas();} 00291 // </group> 00292 00293 // Read-only access to optional columns 00294 // <group> 00295 const ROScalarColumn<Float>& dewPoint() const { 00296 return ROMSWeatherColumns::dewPoint();} 00297 const ROScalarQuantColumn<Float>& dewPointQuant() const { 00298 return ROMSWeatherColumns::dewPointQuant();} 00299 const ROScalarColumn<Bool>& dewPointFlag() const { 00300 return ROMSWeatherColumns::dewPointFlag();} 00301 const ROScalarColumn<Float>& H2O() const { 00302 return ROMSWeatherColumns::H2O();} 00303 const ROScalarColumn<Bool>& H2OFlag() const { 00304 return ROMSWeatherColumns::H2OFlag();} 00305 const ROScalarQuantColumn<Float>& H2OQuant() const { 00306 return ROMSWeatherColumns::H2OQuant();} 00307 const ROScalarColumn<Float>& ionosElectron() const { 00308 return ROMSWeatherColumns::ionosElectron();} 00309 const ROScalarQuantColumn<Float>& ionosElectronQuant() const { 00310 return ROMSWeatherColumns::ionosElectronQuant();} 00311 const ROScalarColumn<Bool>& ionosElectronFlag() const { 00312 return ROMSWeatherColumns::ionosElectronFlag();} 00313 const ROScalarColumn<Float>& pressure() const { 00314 return ROMSWeatherColumns::pressure();} 00315 const ROScalarQuantColumn<Float>& pressureQuant() const { 00316 return ROMSWeatherColumns::pressureQuant();} 00317 const ROScalarColumn<Bool>& pressureFlag() const { 00318 return ROMSWeatherColumns::pressureFlag();} 00319 const ROScalarColumn<Float>& relHumidity() const { 00320 return ROMSWeatherColumns::relHumidity();} 00321 const ROScalarColumn<Bool>& relHumidityFlag() const { 00322 return ROMSWeatherColumns::relHumidityFlag();} 00323 const ROScalarColumn<Float>& temperature() const { 00324 return ROMSWeatherColumns::temperature();} 00325 const ROScalarQuantColumn<Float>& temperatureQuant() const { 00326 return ROMSWeatherColumns::temperatureQuant();} 00327 const ROScalarColumn<Bool>& temperatureFlag() const { 00328 return ROMSWeatherColumns::temperatureFlag();} 00329 const ROScalarColumn<Float>& windDirection() const { 00330 return ROMSWeatherColumns::windDirection();} 00331 const ROScalarQuantColumn<Float>& windDirectionQuant() const { 00332 return ROMSWeatherColumns::windDirectionQuant();} 00333 const ROScalarColumn<Bool>& windDirectionFlag() const { 00334 return ROMSWeatherColumns::windDirectionFlag();} 00335 const ROScalarColumn<Float>& windSpeed() const { 00336 return ROMSWeatherColumns::windSpeed();} 00337 const ROScalarQuantColumn<Float>& windSpeedQuant() const { 00338 return ROMSWeatherColumns::windSpeedQuant();} 00339 const ROScalarColumn<Bool>& windSpeedFlag() const { 00340 return ROMSWeatherColumns::windSpeedFlag();} 00341 // </group> 00342 00343 // set the epoch type for the TIME column. 00344 // <note role=tip> 00345 // In principle this function can only be used if the table is empty, 00346 // otherwise already written values may thereafter have an incorrect 00347 // reference, offset, or unit. However, it is possible that part of the 00348 // table gets written before these values are known. In that case the 00349 // reference, offset, or units can be set by using a False 00350 // <src>tableMustBeEmpty</src> argument. 00351 // </note> 00352 void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True); 00353 00354 protected: 00355 //# default constructor creates a object that is not usable. Use the attach 00356 //# function correct this. 00357 MSWeatherColumns(); 00358 00359 //# attach this object to the supplied table. 00360 void attach(MSWeather& msWeather); 00361 00362 private: 00363 //# Make the assignment operator and the copy constructor private to prevent 00364 //# any compiler generated one from being used. 00365 MSWeatherColumns(const MSWeatherColumns&); 00366 MSWeatherColumns& operator=(const MSWeatherColumns&); 00367 00368 //# Check if any optional columns exist and if so attach them. 00369 void attachOptionalCols(MSWeather& msWeather); 00370 00371 //# required columns 00372 ScalarColumn<Int> antennaId_p; 00373 ScalarColumn<Double> interval_p; 00374 ScalarColumn<Double> time_p; 00375 //# optional columns 00376 ScalarColumn<Float> dewPoint_p; 00377 ScalarColumn<Bool> dewPointFlag_p; 00378 ScalarColumn<Float> H2O_p; 00379 ScalarColumn<Bool> H2OFlag_p; 00380 ScalarColumn<Float> ionosElectron_p; 00381 ScalarColumn<Bool> ionosElectronFlag_p; 00382 ScalarColumn<Float> pressure_p; 00383 ScalarColumn<Bool> pressureFlag_p; 00384 ScalarColumn<Float> relHumidity_p; 00385 ScalarColumn<Bool> relHumidityFlag_p; 00386 ScalarColumn<Float> temperature_p; 00387 ScalarColumn<Bool> temperatureFlag_p; 00388 ScalarColumn<Float> windDirection_p; 00389 ScalarColumn<Bool> windDirectionFlag_p; 00390 ScalarColumn<Float> windSpeed_p; 00391 ScalarColumn<Bool> windSpeedFlag_p; 00392 00393 //# Access to Measure columns 00394 ScalarMeasColumn<MEpoch> timeMeas_p; 00395 00396 //# Access to Quantum columns 00397 ScalarQuantColumn<Double> intervalQuant_p; 00398 ScalarQuantColumn<Double> timeQuant_p; 00399 //# optional Quantum columns 00400 ScalarQuantColumn<Float> dewPointQuant_p; 00401 ScalarQuantColumn<Float> H2OQuant_p; 00402 ScalarQuantColumn<Float> ionosElectronQuant_p; 00403 ScalarQuantColumn<Float> pressureQuant_p; 00404 ScalarQuantColumn<Float> temperatureQuant_p; 00405 ScalarQuantColumn<Float> windDirectionQuant_p; 00406 ScalarQuantColumn<Float> windSpeedQuant_p; 00407 }; 00408 00409 } //# NAMESPACE CASA - END 00410 00411 #endif