SDAntennaHandler.h

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

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1