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