casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
SDFeedHandler.h
Go to the documentation of this file.
00001 //# SDFeedFiller.h: fills the FEED 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: SDFeedHandler.h 18700 2005-05-23 07:45:13Z cvsmgr $
00028 
00029 #ifndef MS_SDFEEDHANDLER_H
00030 #define MS_SDFEEDHANDLER_H
00031 
00032 #include <casa/Containers/RecordField.h>
00033 
00034 namespace casa { //# NAMESPACE CASA - BEGIN
00035 
00036 //# Forward Declarations
00037 class ColumnsIndex;
00038 class MeasurementSet;
00039 class MSFeed;
00040 class MSFeedColumns;
00041 class Record;
00042 
00043 template <class T> class Vector;
00044 
00045 // <summary>
00046 // </summary>
00047 
00048 // <use visibility=local>   or   <use visibility=export>
00049 
00050 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00051 // </reviewed>
00052 
00053 // <prerequisite>
00054 //   <li> SomeClass
00055 //   <li> SomeOtherClass
00056 //   <li> some concept
00057 // </prerequisite>
00058 //
00059 // <etymology>
00060 // </etymology>
00061 //
00062 // <synopsis>
00063 // </synopsis>
00064 //
00065 // <example>
00066 // </example>
00067 //
00068 // <motivation>
00069 // </motivation>
00070 //
00071 // <templating arg=T>
00072 //    <li>
00073 //    <li>
00074 // </templating>
00075 //
00076 // <thrown>
00077 //    <li>
00078 //    <li>
00079 // </thrown>
00080 //
00081 // <todo asof="yyyy/mm/dd">
00082 //   <li> add this feature
00083 //   <li> fix this bug
00084 //   <li> start discussion of this possible extension
00085 // </todo>
00086 
00087 class SDFeedHandler
00088 {
00089 public:
00090     // default ctor is not attached to a MS and hence is useless until attached
00091     SDFeedHandler();
00092 
00093     // attach this to a MS - no columns are explicitly handled here
00094     SDFeedHandler(MeasurementSet &ms, Vector<Bool> &handledCols, const Record &row);
00095 
00096     // copy ctor
00097     SDFeedHandler(const SDFeedHandler &other);
00098 
00099     ~SDFeedHandler() {clearAll();}
00100 
00101     // assignment operator, uses copy semantics
00102     SDFeedHandler &operator=(const SDFeedHandler &other);
00103 
00104     // attach to a MS, the handledCols and row arguments are ignored here
00105     void attach(MeasurementSet &ms, Vector<Bool> &handledCols, const Record &row);
00106 
00107     // reset internals given indicated row, use the same MS
00108     void resetRow(const Record &row);
00109     
00110     // fill - a new row is added only when necessary
00111     void fill(const Record &row, Int antennaId, Int spwinId, const Vector<Int> &stokes);
00112 
00113     // get the current feed ID
00114     Int feedId() {return feedId_p;}
00115 
00116     // the current NUM_RECEPTORS value
00117     Int numReceptors() {return nrecpt_p;}
00118 private:
00119     RecordFieldPtr<Int> numRecpKey_p;
00120     ColumnsIndex *index_p;
00121     MSFeed *msFeed_p;
00122     MSFeedColumns *msFeedCols_p;
00123 
00124     Int feedId_p, nextFeedId_p, nrecpt_p;
00125 
00126     // fields which might be the result of saving via ms2sdfits
00127     RORecordFieldPtr<Int> feed1Field_p, feed2Field_p, beamIdField_p, phasedFeedIdField_p, numReceptorsField_p;
00128     RORecordFieldPtr<Double> intervalField_p, timeField_p, scaReceptorAngleField_p; 
00129     RORecordFieldPtr<Array<Double> > beamOffsetField_p, positionField_p, receptorAngleField_p;
00130     RORecordFieldPtr<Array<Complex> > polResponseField_p;
00131     RORecordFieldPtr<String> polarizationTypeField_p;
00132 
00133     // get the polarization type from the stokes vector
00134     void stokesToPolType(const Vector<Int> &stokes, Vector<String> &polType);
00135 
00136     // cleanup everything
00137     void clearAll();
00138 
00139     void clearRow();
00140 
00141     // initialize everything
00142     void initAll(MeasurementSet &ms, Vector<Bool> &handledCols, const Record &row);
00143 
00144     // initialize things which depend on row
00145     void initRow(Vector<Bool> &handledCols, const Record &row);
00146 };
00147 
00148 
00149 } //# NAMESPACE CASA - END
00150 
00151 #endif
00152 
00153