casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
SDFITSHandler.h
Go to the documentation of this file.
00001 //# SDFITSFiller.h: fills all otherwise unhandled columns 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: SDFITSHandler.h 18700 2005-05-23 07:45:13Z cvsmgr $
00028 
00029 #ifndef MS_SDFITSHANDLER_H
00030 #define MS_SDFITSHANDLER_H
00031 
00032 #include <casa/aips.h>
00033 #include <measures/Measures/MEpoch.h>
00034 #include <measures/TableMeasures/ScalarQuantColumn.h>
00035 #include <measures/TableMeasures/ScalarMeasColumn.h>
00036 
00037 namespace casa { //# NAMESPACE CASA - BEGIN
00038 
00039 //# Forward Declarations
00040 class CopyRecordToTable;
00041 class MeasurementSet;
00042 class Record;
00043 class Table;
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 SDFITSHandler
00090 {
00091 public:
00092     // default ctor is not attached to a MS and hence is useless until attached
00093     SDFITSHandler();
00094 
00095     // attach this to a MS - any unhandled fields in row are handled here.
00096     // This handler must be attached last.
00097     SDFITSHandler(MeasurementSet &ms, Vector<Bool> &handledCols, const Record &row);
00098 
00099     // copy ctor
00100     SDFITSHandler(const SDFITSHandler &other);
00101 
00102     ~SDFITSHandler() {clearAll();}
00103 
00104     // assignment operator, uses copy semantics
00105     SDFITSHandler &operator=(const SDFITSHandler &other);
00106 
00107     // attach to a MS - any unhandled fields in row are handled here.
00108     // This handler must be attached last.
00109     void attach(MeasurementSet &ms, Vector<Bool> &handledCols, const Record &row);
00110 
00111     // fill - a new row is always added
00112     void fill(const Record &row, const MEpoch &time, const Double &interval);
00113 private:
00114     // the output table
00115     Table *tab_p;
00116 
00117     // the TIME column
00118     ScalarMeasColumn<MEpoch> timeMeas_p;
00119 
00120     // the INTERVAL column
00121     ScalarQuantColumn<Double> intervalQuant_p;
00122 
00123     // this copies everything from the row to the table
00124     CopyRecordToTable *copier_p;
00125 
00126     // cleanup everything
00127     void clearAll();
00128 
00129     // cleanup the row related stuff
00130     void clearRow();
00131 
00132     // initialize everything
00133     void initAll(MeasurementSet &ms, Vector<Bool> &handledCols, const Record &row);
00134 
00135     // intialize the row related stuff
00136     void initRow(Vector<Bool> &handledCols, const Vector<String> &colNames, const Record &row);
00137 
00138     // get the required table desc given the unhandled columns and the row
00139     TableDesc requiredTableDesc(Vector<Bool> &handledCols, Vector<String> &colNames, const Record &row);
00140 };
00141 
00142 
00143 } //# NAMESPACE CASA - END
00144 
00145 #endif
00146 
00147