Line data Source code
1 : //# CTColumns.h: provides easy access to (new) CalTable columns 2 : //# Copyright (C) 2011 3 : //# Associated Universities, Inc. Washington DC, USA. 4 : //# 5 : //# This library is free software; you can redistribute it and/or modify it 6 : //# under the terms of the GNU Library General Public License as published by 7 : //# the Free Software Foundation; either version 2 of the License, or (at your 8 : //# option) any later version. 9 : //# 10 : //# This library is distributed in the hope that it will be useful, but WITHOUT 11 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 13 : //# License for more details. 14 : //# 15 : //# You should have received a copy of the GNU Library General Public License 16 : //# along with this library; if not, write to the Free Software Foundation, 17 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 18 : //# 19 : //# Correspondence concerning AIPS++ should be addressed as follows: 20 : //# Internet email: casa-feedback@nrao.edu. 21 : //# Postal address: AIPS++ Project Office 22 : //# National Radio Astronomy Observatory 23 : //# 520 Edgemont Road 24 : //# Charlottesville, VA 22903-2475 USA 25 : //# 26 : //# $Id$ 27 : 28 : #ifndef CALIBRATION_NEWCALTABLECOLUMNS_H 29 : #define CALIBRATION_NEWCALTABLECOLUMNS_H 30 : 31 : #include <casacore/casa/aips.h> 32 : #include <casacore/measures/Measures/MDirection.h> 33 : #include <casacore/measures/Measures/MEpoch.h> 34 : #include <synthesis/CalTables/NewCalTable.h> 35 : #include <synthesis/CalTables/CTMainColumns.h> 36 : #include <casacore/ms/MeasurementSets/MSAntennaColumns.h> 37 : #include <casacore/ms/MeasurementSets/MSFieldColumns.h> 38 : #include <casacore/ms/MeasurementSets/MSHistoryColumns.h> 39 : #include <casacore/ms/MeasurementSets/MSSpWindowColumns.h> 40 : 41 : namespace casa { //# NAMESPACE CASA - BEGIN 42 : 43 : class NewCalTable; 44 : // <summary> 45 : // A class to provide easy read-only access to new CalTable columns 46 : // </summary> 47 : 48 : // <use visibility=export> 49 : 50 : // <reviewed reviewer="" date="" tests="" demos=""> 51 : // </reviewed> 52 : 53 : // <prerequisite> 54 : // <li> NewCalTable 55 : // <li> ArrayColumn 56 : // <li> ScalarColumn 57 : // </prerequisite> 58 : // 59 : // <etymology> 60 : // ROCTColumns stands for Read-Only NewCalTable casacore::Table columns. 61 : // </etymology> 62 : // 63 : // <synopsis> 64 : // This class provides read-only access to the columns in the NewCalTable, similar 65 : // to the casacore::MSColumns for MeasurementSet. 66 : // It does the declaration of all the Scalar and ArrayColumns with the 67 : // correct types, so the application programmer doesn't have to 68 : // worry about getting those right. There is an access function 69 : // for every predefined column. Access to non-predefined columns will still 70 : // have to be done with explicit declarations. 71 : // </synopsis> 72 : // 73 : // <example> 74 : // <srcblock> 75 : // // use as follows 76 : // NewCalTable newcalt("mynewcalt"); 77 : // RONCTColumns nctc(newcalt); 78 : // // show time from row 5 79 : // cout << nctc.time()(5); 80 : // // show name of antenna on row 3 in antenna table 81 : // cout << nctc.antenna().name(); 82 : // </srcblock> 83 : // </example> 84 : // 85 : // <motivation> 86 : // See <linkto class=CTColumns> CTColumns</linkto> for the motivation. 87 : // </motivation> 88 : // 89 : // <todo asof=""> 90 : // </todo> 91 : 92 : class ROCTColumns: public ROCTMainColumns 93 : { 94 : public: 95 : // Create a columns object that accesses the data in the specified MS 96 : ROCTColumns(const NewCalTable& caltable); 97 : 98 : // The destructor does nothing special 99 : ~ROCTColumns(); 100 : 101 : // Access to required subtables 102 : // <group> 103 0 : const ROCTObservationColumns& observation() const {return observation_p;} 104 0 : const ROCTAntennaColumns& antenna() const {return antenna_p;} 105 0 : const ROCTFieldColumns& field() const {return field_p;} 106 : const ROCTHistoryColumns& history() const {return history_p;} 107 0 : const ROCTSpWindowColumns& spectralWindow() const { 108 0 : return spectralWindow_p;} 109 : // </group> 110 : 111 : // Access to optional subtables 112 : // <group> 113 : // </group> 114 : 115 : protected: 116 : friend class NewCalTable; 117 : private: 118 : // Access to subtables 119 : ROCTObservationColumns observation_p; 120 : ROCTAntennaColumns antenna_p; 121 : ROCTFieldColumns field_p; 122 : ROCTHistoryColumns history_p; 123 : ROCTSpWindowColumns spectralWindow_p; 124 : 125 : }; 126 : 127 : // <summary> 128 : // A class to provide easy read-write access to NewCalTable columns 129 : // </summary> 130 : 131 : // <use visibility=export> 132 : 133 : // <reviewed reviewer="" date="" tests="" demos=""> 134 : // </reviewed> 135 : 136 : // <prerequisite> 137 : // <li> NewCalTable 138 : // <li> ArrayColumn 139 : // <li> ScalarColumn 140 : // </prerequisite> 141 : // 142 : // <etymology> 143 : // CTColumns stands for NewCalTable columns. 144 : // </etymology> 145 : // 146 : // <synopsis> 147 : // This class provides access to all the subtables and direct access to all the 148 : // columns in the NewCalTable. It does the declaration of all the Scalar 149 : // and ArrayColumns with the correct types, so the application programmer 150 : // doesn't have to worry about getting those right. There is an access function 151 : // for every predefined column. Access to non-predefined columns will still 152 : // have to be done with explicit declarations. 153 : // </synopsis> 154 : // 155 : // <example> 156 : // <srcblock> 157 : // // use as follows 158 : // NewCalTable newcalt("mynewcalt",casacore::Table::Update); 159 : // CTColumns nctc(newcalt); 160 : // // show time from row 5 161 : // cout << nctc.time()(5); 162 : // // change name of antenna on row 3 in antenna table 163 : // nctc.antenna().name().put(3,"NewAnt-3"); 164 : // </srcblock> 165 : // </example> 166 : // 167 : // <motivation> 168 : // Having to type long lists of Scalar and casacore::Array column declarations gets 169 : // very tedious. This class attempts to relieve some of that tedium, while 170 : // at the same time concentrating all the declarations in one place, 171 : // making Type errors in the column declaration (only caught at run-time) less 172 : // probable. Type errors in the use of the columns is caught at compile 173 : // time. 174 : // </motivation> 175 : // 176 : // <todo asof=""> 177 : // </todo> 178 : 179 : class CTColumns: public CTMainColumns 180 : { 181 : public: 182 : // Create a columns object that accesses the data in the specified caltable 183 : CTColumns(NewCalTable& caltable); 184 : 185 : // The destructor does nothing special 186 : ~CTColumns(); 187 : 188 : // Read-write access to required subtables 189 : // <group> 190 : CTObservationColumns& observation() {return observation_p;} 191 0 : CTAntennaColumns& antenna() {return antenna_p;} 192 : CTFieldColumns& field() {return field_p;} 193 : CTHistoryColumns& history() {return history_p;} 194 0 : CTSpWindowColumns& spectralWindow() {return spectralWindow_p;} 195 : 196 : // </group> 197 : 198 : // Read-write access to optional subtables 199 : // <group> 200 : // </group> 201 : 202 : // Read-only access to required subtables 203 : // <group> 204 : const ROCTObservationColumns& observation() const {return observation_p;} 205 : const ROCTAntennaColumns& antenna() const {return antenna_p;} 206 : const ROCTFieldColumns& field() const {return field_p;} 207 : const ROCTHistoryColumns& history() const {return history_p;} 208 : const ROCTSpWindowColumns& spectralWindow() const { 209 : return spectralWindow_p;} 210 : 211 : //protected: 212 : // friend class NewCalTable; 213 : 214 : private: 215 : // Access to subtables 216 : CTObservationColumns observation_p; 217 : CTAntennaColumns antenna_p; 218 : CTFieldColumns field_p; 219 : CTHistoryColumns history_p; 220 : CTSpWindowColumns spectralWindow_p; 221 : }; 222 : 223 : 224 : } //# NAMESPACE CASA - END 225 : 226 : #endif 227 :