00001 //# MSPointingColumns.h: provides easy access to MSPointing 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$ 00027 00028 #ifndef MS_MSPOINTINGCOLUMNS_H 00029 #define MS_MSPOINTINGCOLUMNS_H 00030 00031 #include <casa/aips.h> 00032 #include <measures/Measures/MDirection.h> 00033 #include <measures/Measures/MEpoch.h> 00034 #include <measures/TableMeasures/ArrayMeasColumn.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 00040 namespace casa { //# NAMESPACE CASA - BEGIN 00041 00042 class MSPointing; 00043 00044 // <summary> 00045 // A class to provide easy read-only access to MSPointing columns 00046 // </summary> 00047 00048 // <use visibility=export> 00049 00050 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos=""> 00051 // </reviewed> 00052 00053 // <prerequisite> 00054 // <li> MSPointing 00055 // <li> ArrayColumn 00056 // <li> ScalarColumn 00057 // </prerequisite> 00058 // 00059 // <etymology> 00060 // ROMSPointingColumns stands for Read-Only MeasurementSet Pointing Table columns. 00061 // </etymology> 00062 // 00063 // <synopsis> 00064 // This class provides read-only access to the columns in the MSPointing 00065 // Table. It does the declaration of all the Scalar and ArrayColumns with the 00066 // correct types, so the application programmer doesn't have to worry about 00067 // getting those right. There is an access function for every predefined 00068 // column. Access to non-predefined columns will still have to be done with 00069 // explicit declarations. See <linkto class=ROMSColumns> 00070 // ROMSColumns</linkto> for an example. 00071 // </synopsis> 00072 // 00073 // <motivation> 00074 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation. 00075 // </motivation> 00076 00077 class ROMSPointingColumns 00078 { 00079 public: 00080 // Create a columns object that accesses the data in the specified Table 00081 ROMSPointingColumns(const MSPointing& msPointing); 00082 00083 // The destructor does nothing special 00084 ~ROMSPointingColumns(); 00085 00086 // Access to required columns 00087 // <group> 00088 const ROScalarColumn<Int>& antennaId() const {return antennaId_p;} 00089 const ROScalarColumn<Double>& time() const {return time_p;} 00090 const ROScalarQuantColumn<Double>& timeQuant() const {return timeQuant_p;} 00091 const ROScalarMeasColumn<MEpoch>& timeMeas() const {return timeMeas_p;} 00092 const ROScalarColumn<Double>& interval() const {return interval_p;} 00093 const ROScalarQuantColumn<Double>& intervalQuant() const { 00094 return intervalQuant_p;} 00095 const ROScalarColumn<String>& name() const {return name_p;} 00096 const ROScalarColumn<Int>& numPoly() const {return numPoly_p;} 00097 const ROScalarColumn<Double>& timeOrigin() const {return timeOrigin_p;} 00098 const ROScalarQuantColumn<Double>& timeOriginQuant() const { 00099 return timeOriginQuant_p;} 00100 const ROScalarMeasColumn<MEpoch>& timeOriginMeas() const { 00101 return timeOriginMeas_p;} 00102 const ROArrayColumn<Double>& direction() const {return direction_p;} 00103 const ROArrayMeasColumn<MDirection>& directionMeasCol() const { 00104 return directionMeas_p;} 00105 const ROArrayColumn<Double>& target() const {return target_p;} 00106 const ROArrayMeasColumn<MDirection>& targetMeasCol()const { 00107 return targetMeas_p;} 00108 const ROScalarColumn<Bool>& tracking() const {return tracking_p;} 00109 // </group> 00110 00111 // Access to optional columns 00112 // <group> 00113 const ROArrayColumn<Double>& pointingOffset() const { 00114 return pointingOffset_p;} 00115 const ROArrayMeasColumn<MDirection>& pointingOffsetMeasCol() const { 00116 return pointingOffsetMeas_p;} 00117 const ROArrayColumn<Double>& sourceOffset() const {return sourceOffset_p;} 00118 const ROArrayMeasColumn<MDirection>& sourceOffsetMeasCol() const { 00119 return sourceOffsetMeas_p;} 00120 const ROArrayColumn<Double>& encoder() const {return encoder_p;} 00121 const ROScalarMeasColumn<MDirection>& encoderMeas() const { 00122 return encoderMeas_p;} 00123 const ROScalarColumn<Int>& pointingModelId() const { 00124 return pointingModelId_p;} 00125 const ROScalarColumn<Bool>& onSource() const {return onSource_p;} 00126 const ROScalarColumn<Bool>& overTheTop() const {return overTheTop_p;} 00127 // </group> 00128 00129 // Access to interpolated directions, the default time of zero will 00130 // return the 0th order element of the polynomial. 00131 // <group> 00132 MDirection directionMeas(Int row, Double time = 0) const; 00133 MDirection targetMeas(Int row, Double time = 0) const; 00134 MDirection pointingOffsetMeas(Int row, Double time = 0) const; 00135 MDirection sourceOffsetMeas(Int row, Double time = 0) const; 00136 // </group> 00137 00138 // return the first matching row index for this time and antenna, 00139 // returns -1 if no match was found 00140 Int pointingIndex(Int antenna, Double time) const; 00141 00142 // Convenience function that returns the number of rows in any of the columns 00143 uInt nrow() const {return antennaId_p.nrow();} 00144 00145 protected: 00146 //# default constructor creates a object that is not usable. Use the attach 00147 //# function correct this. 00148 ROMSPointingColumns(); 00149 00150 //# attach this object to the supplied table. 00151 void attach(const MSPointing& msPointing); 00152 00153 private: 00154 //# Make the assignment operator and the copy constructor private to prevent 00155 //# any compiler generated one from being used. 00156 ROMSPointingColumns(const ROMSPointingColumns&); 00157 ROMSPointingColumns& operator=(const ROMSPointingColumns&); 00158 00159 //# Check if any optional columns exist and if so attach them. 00160 void attachOptionalCols(const MSPointing& msPointing); 00161 00162 //# required columns 00163 ROScalarColumn<Int> antennaId_p; 00164 ROArrayColumn<Double> direction_p; 00165 ROScalarColumn<Double> interval_p; 00166 ROScalarColumn<String> name_p; 00167 ROScalarColumn<Int> numPoly_p; 00168 ROArrayColumn<Double> target_p; 00169 ROScalarColumn<Double> time_p; 00170 ROScalarColumn<Double> timeOrigin_p; 00171 ROScalarColumn<Bool> tracking_p; 00172 //# optional columns 00173 ROArrayColumn<Double> encoder_p; 00174 ROScalarColumn<Bool> onSource_p; 00175 ROScalarColumn<Int> pointingModelId_p; 00176 ROArrayColumn<Double> pointingOffset_p; 00177 ROArrayColumn<Double> sourceOffset_p; 00178 ROScalarColumn<Bool> overTheTop_p; 00179 00180 //# Access to Measure columns 00181 ROArrayMeasColumn<MDirection> directionMeas_p; 00182 ROArrayMeasColumn<MDirection> targetMeas_p; 00183 ROScalarMeasColumn<MEpoch> timeMeas_p; 00184 ROScalarMeasColumn<MEpoch> timeOriginMeas_p; 00185 //# optional Measure columns 00186 ROScalarMeasColumn<MDirection> encoderMeas_p; 00187 ROArrayMeasColumn<MDirection> pointingOffsetMeas_p; 00188 ROArrayMeasColumn<MDirection> sourceOffsetMeas_p; 00189 00190 //# Access to Quantum columns 00191 ROScalarQuantColumn<Double> intervalQuant_p; 00192 ROScalarQuantColumn<Double> timeQuant_p; 00193 ROScalarQuantColumn<Double> timeOriginQuant_p; 00194 }; 00195 00196 // <summary> 00197 // A class to provide easy read-write access to MSPointing columns 00198 // </summary> 00199 00200 // <use visibility=export> 00201 00202 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos=""> 00203 // </reviewed> 00204 00205 // <prerequisite> 00206 // <li> MSPointing 00207 // <li> ArrayColumn 00208 // <li> ScalarColumn 00209 // </prerequisite> 00210 // 00211 // <etymology> 00212 // MSPointingColumns stands for MeasurementSet Pointing Table columns. 00213 // </etymology> 00214 // 00215 // <synopsis> 00216 // This class provides access to the columns in the MSPointing Table, 00217 // it does the declaration of all the Scalar and ArrayColumns with the 00218 // correct types, so the application programmer doesn't have to 00219 // worry about getting those right. There is an access function 00220 // for every predefined column. Access to non-predefined columns will still 00221 // have to be done with explicit declarations. 00222 // See <linkto class=MSColumns> MSColumns</linkto> for an example. 00223 // </synopsis> 00224 // 00225 // <motivation> 00226 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation. 00227 // </motivation> 00228 00229 class MSPointingColumns: public ROMSPointingColumns 00230 { 00231 public: 00232 // Construct from the supplied Table 00233 MSPointingColumns(MSPointing& msPointing); 00234 00235 // The destructor does nothing special 00236 ~MSPointingColumns(); 00237 00238 // Read-write access to required columns 00239 // 00240 // Note that the direction measures with a stored polynomial have Col() added 00241 // to their name. They are better accessed via the functions that have the 00242 // same name, without the Col suffix, that will do the interpolation for 00243 // you. These functions are in the ROMSPointingColumns class. 00244 // <group> 00245 ScalarColumn<Int>& antennaId() {return antennaId_p;} 00246 ScalarColumn<Double>& time() {return time_p;} 00247 ScalarMeasColumn<MEpoch>& timeMeas() {return timeMeas_p;} 00248 ScalarQuantColumn<Double>& timeQuant() {return timeQuant_p;} 00249 ScalarColumn<Double>& interval() {return interval_p;} 00250 ScalarQuantColumn<Double>& intervalQuant() {return intervalQuant_p;} 00251 ScalarColumn<String>& name() {return name_p;} 00252 ScalarColumn<Int>& numPoly() {return numPoly_p;} 00253 ScalarColumn<Double>& timeOrigin() {return timeOrigin_p;} 00254 ScalarQuantColumn<Double>& timeOriginQuant() {return timeOriginQuant_p;} 00255 ScalarMeasColumn<MEpoch>& timeOriginMeas() {return timeOriginMeas_p;} 00256 ArrayColumn<Double>& direction() {return direction_p;} 00257 ArrayMeasColumn<MDirection>& directionMeasCol() {return directionMeas_p;} 00258 ArrayColumn<Double>& target() {return target_p;} 00259 ArrayMeasColumn<MDirection>& targetMeasCol() {return targetMeas_p;} 00260 ScalarColumn<Bool>& tracking() {return tracking_p;} 00261 // </group> 00262 00263 // Read-write access to optional columns 00264 // 00265 // Note that the direction measures with a stored polynomial have Col() added 00266 // to their name. They are better accessed via the functions that have the 00267 // same name, without the Col suffix, that will do the interpolation for 00268 // you. These functions are in the ROMSPointingColumns class. 00269 // <group> 00270 ArrayColumn<Double>& pointingOffset() {return pointingOffset_p;} 00271 ArrayMeasColumn<MDirection>& pointingOffsetMeasCol() { 00272 return pointingOffsetMeas_p;} 00273 ArrayColumn<Double>& sourceOffset() {return sourceOffset_p;} 00274 ArrayMeasColumn<MDirection>& sourceOffsetMeasCol() { 00275 return sourceOffsetMeas_p;} 00276 ArrayColumn<Double>& encoder() {return encoder_p;} 00277 ScalarMeasColumn<MDirection>& encoderMeas() {return encoderMeas_p;} 00278 ScalarColumn<Int>& pointingModelId() {return pointingModelId_p;} 00279 ScalarColumn<Bool>& onSource() {return onSource_p;} 00280 ScalarColumn<Bool>& overTheTop() {return overTheTop_p;} 00281 // </group> 00282 00283 // Read-only access to required columns 00284 // <group> 00285 const ROScalarColumn<Int>& antennaId() const { 00286 return ROMSPointingColumns::antennaId();} 00287 const ROScalarColumn<Double>& time() const { 00288 return ROMSPointingColumns::time();} 00289 const ROScalarQuantColumn<Double>& timeQuant() const { 00290 return ROMSPointingColumns::timeQuant();} 00291 const ROScalarMeasColumn<MEpoch>& timeMeas() const { 00292 return ROMSPointingColumns::timeMeas();} 00293 const ROScalarColumn<Double>& interval() const { 00294 return ROMSPointingColumns::interval();} 00295 const ROScalarQuantColumn<Double>& intervalQuant() const { 00296 return ROMSPointingColumns::intervalQuant();} 00297 const ROScalarColumn<String>& name() const { 00298 return ROMSPointingColumns::name();} 00299 const ROScalarColumn<Int>& numPoly() const { 00300 return ROMSPointingColumns::numPoly();} 00301 const ROScalarColumn<Double>& timeOrigin() const { 00302 return ROMSPointingColumns::timeOrigin();} 00303 const ROScalarQuantColumn<Double>& timeOriginQuant() const { 00304 return ROMSPointingColumns::timeOriginQuant();} 00305 const ROScalarMeasColumn<MEpoch>& timeOriginMeas() const { 00306 return ROMSPointingColumns::timeOriginMeas();} 00307 const ROArrayColumn<Double>& direction() const { 00308 return ROMSPointingColumns::direction();} 00309 const ROArrayMeasColumn<MDirection>& directionMeasCol() const { 00310 return ROMSPointingColumns::directionMeasCol();} 00311 const ROArrayColumn<Double>& target() const { 00312 return ROMSPointingColumns::target();} 00313 const ROArrayMeasColumn<MDirection>& targetMeasCol()const { 00314 return ROMSPointingColumns::targetMeasCol();} 00315 const ROScalarColumn<Bool>& tracking() const { 00316 return ROMSPointingColumns::tracking();} 00317 // </group> 00318 00319 // Access to optional columns 00320 // <group> 00321 const ROArrayColumn<Double>& pointingOffset() const { 00322 return ROMSPointingColumns::pointingOffset();} 00323 const ROArrayMeasColumn<MDirection>& pointingOffsetMeasCol() const { 00324 return ROMSPointingColumns::pointingOffsetMeasCol();} 00325 const ROArrayColumn<Double>& sourceOffset() const { 00326 return ROMSPointingColumns::sourceOffset();} 00327 const ROArrayMeasColumn<MDirection>& sourceOffsetMeasCol() const { 00328 return ROMSPointingColumns::sourceOffsetMeasCol();} 00329 const ROArrayColumn<Double>& encoder() const { 00330 return ROMSPointingColumns::encoder();} 00331 const ROScalarMeasColumn<MDirection>& encoderMeas() const { 00332 return ROMSPointingColumns::encoderMeas();} 00333 const ROScalarColumn<Int>& pointingModelId() const { 00334 return ROMSPointingColumns::pointingModelId();} 00335 const ROScalarColumn<Bool>& onSource() const { 00336 return ROMSPointingColumns::onSource();} 00337 const ROScalarColumn<Bool>& overTheTop() const { 00338 return ROMSPointingColumns::overTheTop();} 00339 // </group> 00340 00341 // set the epoch reference type for the TIME & TIME_ORIGIN column. 00342 // <note role=tip> 00343 // In principle this function can only be used if the table is empty, 00344 // otherwise already written values may thereafter have an incorrect 00345 // reference, offset, or unit. However, it is possible that part of the 00346 // table gets written before these values are known. In that case the 00347 // reference, offset, or units can be set by using a False 00348 // <src>tableMustBeEmpty</src> argument. 00349 // </note> 00350 void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True); 00351 00352 // set the direction reference type for the DIRECTION, TARGET & and, if 00353 // defined, the SOURCE_OFFSET & POINTING_OFFSET columns. This can only be 00354 // done when the table has no rows. Trying to do so at other times will throw 00355 // an exception. Note the optional ENCODERE column must be done separately as 00356 // the MSv2 definition allows this column to have a different frame. 00357 void setDirectionRef(MDirection::Types ref); 00358 00359 // set the irection reference type for the ENCODER column (if it is defined). 00360 // This can only be done when the table has no rows. Trying to do so at other 00361 // times will throw an exception. 00362 void setEncoderDirectionRef(MDirection::Types ref); 00363 00364 protected: 00365 //# default constructor creates a object that is not usable. Use the attach 00366 //# function correct this. 00367 MSPointingColumns(); 00368 00369 //# attach this object to the supplied table. 00370 void attach(MSPointing& msPointing); 00371 00372 private: 00373 //# Make the assignment operator and the copy constructor private to prevent 00374 //# any compiler generated one from being used. 00375 MSPointingColumns(const MSPointingColumns&); 00376 MSPointingColumns& operator=(const MSPointingColumns&); 00377 00378 //# Check if any optional columns exist and if so attach them. 00379 void attachOptionalCols(MSPointing& msPointing); 00380 00381 //# required columns 00382 ScalarColumn<Int> antennaId_p; 00383 ArrayColumn<Double> direction_p; 00384 ScalarColumn<Double> interval_p; 00385 ScalarColumn<String> name_p; 00386 ScalarColumn<Int> numPoly_p; 00387 ArrayColumn<Double> target_p; 00388 ScalarColumn<Double> time_p; 00389 ScalarColumn<Double> timeOrigin_p; 00390 ScalarColumn<Bool> tracking_p; 00391 //# optional columns 00392 ArrayColumn<Double> encoder_p; 00393 ScalarColumn<Bool> onSource_p; 00394 ScalarColumn<Int> pointingModelId_p; 00395 ArrayColumn<Double> pointingOffset_p; 00396 ArrayColumn<Double> sourceOffset_p; 00397 ScalarColumn<Bool> overTheTop_p; 00398 00399 //# Access to Measure columns 00400 ArrayMeasColumn<MDirection> directionMeas_p; 00401 ArrayMeasColumn<MDirection> targetMeas_p; 00402 ScalarMeasColumn<MEpoch> timeMeas_p; 00403 ScalarMeasColumn<MEpoch> timeOriginMeas_p; 00404 //# optional Measure columns 00405 ScalarMeasColumn<MDirection> encoderMeas_p; 00406 ArrayMeasColumn<MDirection> pointingOffsetMeas_p; 00407 ArrayMeasColumn<MDirection> sourceOffsetMeas_p; 00408 00409 //# Access to Quantum columns 00410 ScalarQuantColumn<Double> intervalQuant_p; 00411 ScalarQuantColumn<Double> timeQuant_p; 00412 ScalarQuantColumn<Double> timeOriginQuant_p; 00413 }; 00414 00415 } //# NAMESPACE CASA - END 00416 00417 #endif
1.5.1