SDPointingHandler.h

Go to the documentation of this file.
00001 //# SDPointingFiller.h: fills the POINTING 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_SDPOINTINGHANDLER_H
00030 #define MS_SDPOINTINGHANDLER_H
00031 
00032 #include <casacore/casa/aips.h>
00033 #include <casacore/casa/Containers/RecordField.h>
00034 #include <casacore/measures/Measures/MDirection.h>
00035 #include <casacore/casa/Arrays/Matrix.h>
00036 
00037 namespace casacore { //# NAMESPACE CASACORE - BEGIN
00038 
00039 //# Forward Declarations
00040 class MeasurementSet;
00041 class MSPointing;
00042 class MSPointingColumns;
00043 class Record;
00044 
00045 template <class T> class Vector;
00046 
00047 // <summary>
00048 // </summary>
00049 
00050 // <use visibility=local>   or   <use visibility=export>
00051 
00052 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00053 // </reviewed>
00054 
00055 // <prerequisite>
00056 //   <li> SomeClass
00057 //   <li> SomeOtherClass
00058 //   <li> some concept
00059 // </prerequisite>
00060 //
00061 // <etymology>
00062 // </etymology>
00063 //
00064 // <synopsis>
00065 // </synopsis>
00066 //
00067 // <example>
00068 // </example>
00069 //
00070 // <motivation>
00071 // </motivation>
00072 //
00073 // <templating arg=T>
00074 //    <li>
00075 //    <li>
00076 // </templating>
00077 //
00078 // <thrown>
00079 //    <li>
00080 //    <li>
00081 // </thrown>
00082 //
00083 // <todo asof="yyyy/mm/dd">
00084 //   <li> add this feature
00085 //   <li> fix this bug
00086 //   <li> start discussion of this possible extension
00087 // </todo>
00088 
00089 class SDPointingHandler
00090 {
00091 public:
00092     // default ctor is not attached to a MS and hence is useless until attached
00093     SDPointingHandler();
00094 
00095     // attach this to a MS, mark fields row which are handled here
00096     SDPointingHandler(MeasurementSet &ms, Vector<Bool> &handledCols, const Record &row);
00097 
00098     // copy ctor
00099     SDPointingHandler(const SDPointingHandler &other);
00100 
00101     ~SDPointingHandler() {clearAll();}
00102 
00103     // assignment operator, uses copy semantics
00104     SDPointingHandler &operator=(const SDPointingHandler &other);
00105 
00106     // attach to a MS, mark fields in row which are handled here
00107     void attach(MeasurementSet &ms, Vector<Bool> &handledCols, const Record &row);
00108 
00109     // reset internals given indicated row, use the same MS
00110     void resetRow(const Record &);
00111     
00112     // fill - a new row is added when 
00113     //      a) the name changes
00114     //      b) the time changes such that it would be outside of the new interval when
00115     //         added to the old interval (i.e. intervals do not overlap)
00116     //      c) the direction changes
00117     //      d) the antennaId changes
00118     //  There is no look-back to see if a previous row could be re-used
00119     void fill(const Record &row, Int antennaId, Double time, const Vector<Double> &timeRange,
00120               const MDirection &direction, const MeasFrame &frame);
00121 
00122     // convenience functions for use when filling the FIELD table, which is mostly
00123     // just a clone of this table for SD data
00124     Int nrow() {return rownr_p+1;}
00125     const String &name() {return name_p;}
00126     Int directionRefType() {return dirColRef_p.getType();}
00127     const Matrix<Double> &directionPoly() {return directionPoly_p;}
00128     Double time() {return time_p;}
00129 private:
00130     MSPointing *msPointing_p;
00131     MSPointingColumns *msPointingCols_p;
00132 
00133     Double time_p;
00134 
00135     Int antId_p;
00136     MDirection direction_p;
00137     Matrix<Double> directionPoly_p;
00138     Vector<Double> directionRate_p;
00139     String name_p;
00140 
00141     Int rownr_p;
00142 
00143     MDirection::Ref dirColRef_p;
00144 
00145     RORecordFieldPtr<String> objectField_p;
00146 
00147     // these might come from an MS table
00148     // this can just come from an MS v1 table
00149     RORecordFieldPtr<Array<Double> > pointingDirRateField_p;
00150     RORecordFieldPtr<Double> intervalField_p, timeField_p;
00151     RORecordFieldPtr<String> nameField_p;
00152     RORecordFieldPtr<Bool> trackingField_p;
00153 
00154     // cleanup everything
00155     void clearAll();
00156 
00157     // cleanup things which depend on the row
00158     void clearRow();
00159 
00160     // initialize everything
00161     void initAll(MeasurementSet &ms, Vector<Bool> &handledCols, const Record &row);
00162 
00163     // initialize everythign which depends on row
00164     void initRow(Vector<Bool> &handledCols, const Record &row);
00165 };
00166 
00167 
00168 } //# NAMESPACE CASACORE - END
00169 
00170 #endif
00171 
00172 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1