casa
$Rev:20696$
|
00001 //# SDAntennaFiller.h: fills the ANTENNA table for the SDFITS filler 00002 //# Copyright (C) 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 //# 00027 //# $Id: SDAntennaHandler.h 18700 2005-05-23 07:45:13Z cvsmgr $ 00028 00029 #ifndef MS_SDANTENNAHANDLER_H 00030 #define MS_SDANTENNAHANDLER_H 00031 00032 #include <casa/Containers/RecordField.h> 00033 #include <casa/BasicSL/String.h> 00034 #include <measures/Measures/MPosition.h> 00035 #include <casa/Arrays/Array.h> 00036 00037 namespace casa { //# NAMESPACE CASA - BEGIN 00038 00039 //# Forward Declarations 00040 class ColumnsIndex; 00041 class MeasurementSet; 00042 class MSAntenna; 00043 class MSAntennaColumns; 00044 class Record; 00045 00046 template <class T> class Vector; 00047 00048 // <summary> 00049 // </summary> 00050 00051 // <use visibility=local> or <use visibility=export> 00052 00053 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00054 // </reviewed> 00055 00056 // <prerequisite> 00057 // <li> SomeClass 00058 // <li> SomeOtherClass 00059 // <li> some concept 00060 // </prerequisite> 00061 // 00062 // <etymology> 00063 // </etymology> 00064 // 00065 // <synopsis> 00066 // </synopsis> 00067 // 00068 // <example> 00069 // </example> 00070 // 00071 // <motivation> 00072 // </motivation> 00073 // 00074 // <templating arg=T> 00075 // <li> 00076 // <li> 00077 // </templating> 00078 // 00079 // <thrown> 00080 // <li> 00081 // <li> 00082 // </thrown> 00083 // 00084 // <todo asof="yyyy/mm/dd"> 00085 // <li> add this feature 00086 // <li> fix this bug 00087 // <li> start discussion of this possible extension 00088 // </todo> 00089 00090 class SDAntennaHandler 00091 { 00092 public: 00093 // default ctor is not attached to a MS and hence is useless until attached 00094 SDAntennaHandler(); 00095 00096 // attach this to a MS, mark the appropriate columns as handled given 00097 // the indicated row 00098 SDAntennaHandler(MeasurementSet &ms, Vector<Bool> &handledCols, const Record &row); 00099 00100 // copy ctor 00101 SDAntennaHandler(const SDAntennaHandler &other); 00102 00103 ~SDAntennaHandler() {clearAll();} 00104 00105 // assignment operator, uses copy semantics 00106 SDAntennaHandler &operator=(const SDAntennaHandler &other); 00107 00108 // attach to a MS, mark the appropriate columns as handled given the 00109 void attach(MeasurementSet &ms, Vector<Bool> &handledCols, const Record &row); 00110 00111 // reset internals given indicated row, use the same MS 00112 void resetRow(const Record &row); 00113 00114 // fill - a new row is added only when necessary 00115 void fill(const Record &row); 00116 00117 // get the current antenna ID 00118 Int antennaId() {return rownr_p;} 00119 00120 // get the telescope name 00121 String telescopeName() {return name_p;} 00122 00123 // get the telescope position 00124 const MPosition &telescopePosition() {return position_p;} 00125 private: 00126 ColumnsIndex *index_p; 00127 RecordFieldPtr<String> nameKey_p, stationKey_p, mountKey_p; 00128 RecordFieldPtr<Double> dishDiameterKey_p; 00129 RecordFieldPtr<Int> orbitIdKey_p, phasedIdKey_p; 00130 RecordFieldPtr<Bool> flagRowKey_p; 00131 MSAntenna *msAnt_p; 00132 MSAntennaColumns *msAntCols_p; 00133 00134 Int rownr_p; 00135 00136 // pointers to fields in record, only used if attached 00137 RORecordFieldPtr<String> telescopField_p; 00138 00139 // telescope position might be a double or float, 00140 // just remember its location 00141 Int siteLongFldNum_p, siteLatFldNum_p, siteElevFldNum_p; 00142 00143 String name_p; 00144 MPosition position_p; 00145 00146 // fields which might exist if this SDFITS was converted from an MS using ms2sdfits 00147 RORecordFieldPtr<String> mountField_p, msNameField_p, stationField_p; 00148 RORecordFieldPtr<Int> orbitIdField_p, phasedArrayIdField_p; 00149 RORecordFieldPtr<Double> dishDiameterField_p; 00150 RORecordFieldPtr<Array<Double> > offsetField_p, positionField_p; 00151 RORecordFieldPtr<Bool> flagRowField_p; 00152 00153 // I expect these will never be used, nevertheless, put them here just in case I'm wrong 00154 void addPhasedArrayIdColumn(); 00155 void addOrbitIdColumn(); 00156 00157 // cleanup everything 00158 void clearAll(); 00159 00160 // cleanup things which depend on the row description being fixed 00161 void clearRow(); 00162 00163 // initialize everything 00164 void initAll(MeasurementSet &ms, Vector<Bool> &handledCols, const Record &row); 00165 00166 // initialize the things which depend on the row 00167 void initRow(Vector<Bool> &handledCols, const Record &row); 00168 }; 00169 00170 00171 } //# NAMESPACE CASA - END 00172 00173 #endif 00174 00175