casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
SDMainHandler.h
Go to the documentation of this file.
00001 //# SDMainFiller.h: fills the MAIN 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: SDMainHandler.h 18700 2005-05-23 07:45:13Z cvsmgr $
00028 
00029 #ifndef MS_SDMAINHANDLER_H
00030 #define MS_SDMAINHANDLER_H
00031 
00032 #include <casa/aips.h>
00033 #include <casa/Utilities/DataType.h>
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 //# Forward Declarations
00038 class MeasurementSet;
00039 class MSMainColumns;
00040 class MEpoch;
00041 class MVTime;
00042 class Record;
00043 
00044 template <class T> class Vector;
00045 template <class T> class Matrix;
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 SDMainHandler
00090 {
00091 public:
00092     // default ctor is not attached to a MS and hence is useless until attached
00093     SDMainHandler();
00094 
00095     // attach this to a MS - mark fields in row as handled
00096     SDMainHandler(MeasurementSet &ms, Vector<Bool> &handledCols, const Record &row);
00097 
00098     // copy ctor
00099     SDMainHandler(const SDMainHandler &other);
00100 
00101     ~SDMainHandler() {clearAll();}
00102 
00103     // assignment operator, uses copy semantics
00104     SDMainHandler &operator=(const SDMainHandler &other);
00105 
00106     // attach to a MS, mark fields in row as handled
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 &row);
00111     
00112     // fill - a new row is always added
00113     void fill(const Record &row, const MEpoch &time, Int antennaId, Int feedId,
00114               Int dataDescId, Int fieldId, const MVTime &exposure, 
00115               Int observationId, const Matrix<Float> &floatData);
00116 private:
00117     MeasurementSet *ms_p;
00118     MSMainColumns *msCols_p;
00119 
00120     Int scanNumberId_p;
00121     DataType scanNumberType_p;
00122 
00123     // fields from sdfits2ms, independent of MS version number so far
00124     Int arrayIdId_p, sigmaId_p, flagRowId_p, intervalId_p, weightId_p, flagId_p,
00125                 timeCentroidId_p;
00126 
00127     // cleanup everything
00128     void clearAll();
00129 
00130     // cleanup row-related stuff
00131     void clearRow();
00132 
00133     // initialize everything
00134     void initAll(MeasurementSet &ms, Vector<Bool> &handledCols, const Record &row);
00135 
00136     // intialize the row related stuff
00137     void initRow(Vector<Bool> &handledCols, const Record &row);
00138 };
00139 
00140 
00141 } //# NAMESPACE CASA - END
00142 
00143 #endif
00144 
00145