casa
$Rev:20696$
|
00001 //# MSHistoryColumns.h: provides easy access to MSHistory 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: MSHistoryColumns.h 20855 2010-01-28 13:35:00Z gervandiepen $ 00027 00028 #ifndef MS_MSHISTORYCOLUMNS_H 00029 #define MS_MSHISTORYCOLUMNS_H 00030 00031 #include <casa/aips.h> 00032 #include <measures/Measures/MEpoch.h> 00033 #include <measures/Measures/MCEpoch.h> 00034 #include <tables/Tables/ScalarColumn.h> 00035 #include <tables/Tables/ArrayColumn.h> 00036 #include <measures/TableMeasures/ScalarMeasColumn.h> 00037 #include <measures/TableMeasures/ScalarQuantColumn.h> 00038 #include <casa/BasicSL/String.h> 00039 00040 namespace casa { //# NAMESPACE CASA - BEGIN 00041 00042 class MSHistory; 00043 // <summary> 00044 // A class to provide easy read-only access to MSHistory columns 00045 // </summary> 00046 00047 // <use visibility=export> 00048 00049 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos=""> 00050 // </reviewed> 00051 00052 // <prerequisite> 00053 // <li> MSHistory 00054 // <li> ArrayColumn 00055 // <li> ScalarColumn 00056 // </prerequisite> 00057 // 00058 // <etymology> 00059 // ROMSHistoryColumns stands for Read-Only MeasurementSet History Table columns. 00060 // </etymology> 00061 // 00062 // <synopsis> 00063 // This class provides read-only access to the columns in the MSHistory 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 ROMSHistoryColumns 00077 { 00078 public: 00079 // Create a columns object that accesses the data in the specified Table 00080 ROMSHistoryColumns(const MSHistory& msHistory); 00081 00082 // The destructor does nothing special 00083 ~ROMSHistoryColumns(); 00084 00085 // Access to required columns 00086 // <group> 00087 const ROScalarColumn<String>& application() const {return application_p;} 00088 const ROArrayColumn<String>& appParams() const {return appParams_p;} 00089 const ROArrayColumn<String>& cliCommand() const {return cliCommand_p;} 00090 const ROScalarColumn<String>& message() const {return message_p;} 00091 const ROScalarColumn<Int>& objectId() const {return objectId_p;} 00092 const ROScalarColumn<Int>& observationId() const {return observationId_p;} 00093 const ROScalarColumn<String>& origin() const {return origin_p;} 00094 const ROScalarColumn<String>& priority() const {return priority_p;} 00095 const ROScalarColumn<Double>& time() const {return time_p;} 00096 const ROScalarQuantColumn<Double>& timeQuant() const {return timeQuant_p;} 00097 const ROScalarMeasColumn<MEpoch>& timeMeas() const {return timeMeas_p;} 00098 // </group> 00099 00100 // Convenience function that returns the number of rows in any of the columns 00101 uInt nrow() const {return application_p.nrow();} 00102 00103 protected: 00104 //# default constructor creates a object that is not usable. Use the attach 00105 //# function correct this. 00106 ROMSHistoryColumns(); 00107 00108 //# attach this object to the supplied table. 00109 void attach(const MSHistory& msHistory); 00110 00111 private: 00112 //# Make the assignment operator and the copy constructor private to prevent 00113 //# any compiler generated one from being used. 00114 ROMSHistoryColumns(const ROMSHistoryColumns&); 00115 ROMSHistoryColumns& operator=(const ROMSHistoryColumns&); 00116 00117 //# required columns 00118 ROScalarColumn<String> application_p; 00119 ROArrayColumn<String> appParams_p; 00120 ROArrayColumn<String> cliCommand_p; 00121 ROScalarColumn<String> message_p; 00122 ROScalarColumn<Int> objectId_p; 00123 ROScalarColumn<Int> observationId_p; 00124 ROScalarColumn<String> origin_p; 00125 ROScalarColumn<String> priority_p; 00126 ROScalarColumn<Double> time_p; 00127 00128 //# Access to Measure columns 00129 ROScalarMeasColumn<MEpoch> timeMeas_p; 00130 00131 //# Access to Quantum columns 00132 ROScalarQuantColumn<Double> timeQuant_p; 00133 }; 00134 00135 // <summary> 00136 // A class to provide easy read-write access to MSHistory columns 00137 // </summary> 00138 00139 // <use visibility=export> 00140 00141 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos=""> 00142 // </reviewed> 00143 00144 // <prerequisite> 00145 // <li> MSHistory 00146 // <li> ArrayColumn 00147 // <li> ScalarColumn 00148 // </prerequisite> 00149 // 00150 // <etymology> 00151 // MSHistoryColumns stands for MeasurementSet History Table columns. 00152 // </etymology> 00153 // 00154 // <synopsis> 00155 // This class provides access to the columns in the MSHistory Table, 00156 // it does the declaration of all the Scalar and ArrayColumns with the 00157 // correct types, so the application programmer doesn't have to 00158 // worry about getting those right. There is an access function 00159 // for every predefined column. Access to non-predefined columns will still 00160 // have to be done with explicit declarations. 00161 // See <linkto class=MSColumns> MSColumns</linkto> for an example. 00162 // 00163 // Note by GvD 28-Jan-2010: 00164 // According to note 229 the OBJECTID column should contain Strings. 00165 // It is, however, defined as Int. It has to be left as such, otherwise older 00166 // MeasurementSets cannot be read anymore. 00167 // </synopsis> 00168 // 00169 // <motivation> 00170 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation. 00171 // </motivation> 00172 00173 class MSHistoryColumns: public ROMSHistoryColumns 00174 { 00175 public: 00176 // Create a columns object that accesses the data in the specified Table 00177 MSHistoryColumns(MSHistory& msHistory); 00178 00179 // The destructor does nothing special 00180 ~MSHistoryColumns(); 00181 00182 // Read-write access to required columns 00183 // <group> 00184 ScalarColumn<String>& application() {return application_p;} 00185 ArrayColumn<String>& appParams() {return appParams_p;} 00186 ArrayColumn<String>& cliCommand() {return cliCommand_p;} 00187 ScalarColumn<String>& message() {return message_p;} 00188 ScalarColumn<Int>& objectId() {return objectId_p;} 00189 ScalarColumn<Int>& observationId() {return observationId_p;} 00190 ScalarColumn<String>& origin() {return origin_p;} 00191 ScalarColumn<String>& priority() {return priority_p;} 00192 ScalarColumn<Double>& time() {return time_p;} 00193 ScalarQuantColumn<Double>& timeQuant() {return timeQuant_p;} 00194 ScalarMeasColumn<MEpoch>& timeMeas() {return timeMeas_p;} 00195 // </group> 00196 00197 // Read-only access to required columns 00198 // <group> 00199 const ROScalarColumn<String>& application() const { 00200 return ROMSHistoryColumns::application();} 00201 const ROArrayColumn<String>& appParams() const { 00202 return ROMSHistoryColumns::appParams();} 00203 const ROArrayColumn<String>& cliCommand() const { 00204 return ROMSHistoryColumns::cliCommand();} 00205 const ROScalarColumn<String>& message() const { 00206 return ROMSHistoryColumns::message();} 00207 const ROScalarColumn<Int>& objectId() const { 00208 return ROMSHistoryColumns::objectId();} 00209 const ROScalarColumn<Int>& observationId() const { 00210 return ROMSHistoryColumns::observationId();} 00211 const ROScalarColumn<String>& origin() const { 00212 return ROMSHistoryColumns::origin();} 00213 const ROScalarColumn<String>& priority() const { 00214 return ROMSHistoryColumns::priority();} 00215 const ROScalarColumn<Double>& time() const { 00216 return ROMSHistoryColumns::time();} 00217 const ROScalarQuantColumn<Double>& timeQuant() const { 00218 return ROMSHistoryColumns::timeQuant();} 00219 const ROScalarMeasColumn<MEpoch>& timeMeas() const { 00220 return ROMSHistoryColumns::timeMeas();} 00221 // </group> 00222 00223 // set the epoch type for the TIME column. 00224 // <note role=tip> 00225 // In principle this function can only be used if the table is empty, 00226 // otherwise already written values may thereafter have an incorrect 00227 // reference, offset, or unit. However, it is possible that part of the 00228 // table gets written before these values are known. In that case the 00229 // reference, offset, or units can be set by using a False 00230 // <src>tableMustBeEmpty</src> argument. 00231 // </note> 00232 void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True); 00233 00234 protected: 00235 //# default constructor creates a object that is not usable. Use the attach 00236 //# function correct this. 00237 MSHistoryColumns(); 00238 00239 //# attach this object to the supplied table. 00240 void attach(MSHistory& msHistory); 00241 00242 private: 00243 //# Make the assignment operator and the copy constructor private to prevent 00244 //# any compiler generated one from being used. 00245 MSHistoryColumns(const MSHistoryColumns&); 00246 MSHistoryColumns& operator=(const MSHistoryColumns&); 00247 00248 //# required columns 00249 ScalarColumn<String> application_p; 00250 ArrayColumn<String> appParams_p; 00251 ArrayColumn<String> cliCommand_p; 00252 ScalarColumn<String> message_p; 00253 ScalarColumn<Int> objectId_p; 00254 ScalarColumn<Int> observationId_p; 00255 ScalarColumn<String> origin_p; 00256 ScalarColumn<String> priority_p; 00257 ScalarColumn<Double> time_p; 00258 00259 //# Access to Measure columns 00260 ScalarMeasColumn<MEpoch> timeMeas_p; 00261 00262 //# Access to Quantum columns 00263 ScalarQuantColumn<Double> timeQuant_p; 00264 }; 00265 00266 } //# NAMESPACE CASA - END 00267 00268 #endif