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