casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
GBTMSPolarizationFiller.h
Go to the documentation of this file.
00001 //# GBTMSPolarizationFiller.h: GBTMSPolarizationFiller fills the MSPolarization table for GBT fillers
00002 //# Copyright (C) 2000,2001
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 NRAO_GBTMSPOLARIZATIONFILLER_H
00030 #define NRAO_GBTMSPOLARIZATIONFILLER_H
00031 
00032 #include <casa/aips.h>
00033 #include <casa/Containers/RecordField.h>
00034 #include <ms/MeasurementSets/MSPolarization.h>
00035 
00036 //# Forward Declarations
00037 namespace casa { //# NAMESPACE CASA - BEGIN
00038 class ColumnsIndex;
00039 class MSPolarizationColumns;
00040 template <class T> class Matrix;
00041 template <class T> class Vector;
00042 } //# NAMESPACE CASA - END
00043 
00044 #include <casa/namespace.h>
00045 
00046 // <summary>
00047 // GBTMSPolarizationFiller fills the MSPolarization table for GBT fillers
00048 // </summary>
00049 
00050 // <use visibility=local>
00051 
00052 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00053 // </reviewed>
00054 
00055 // <prerequisite>
00056 //   <li> MeasurementSets
00057 //   <li> GBT FITS files
00058 // </prerequisite>
00059 //
00060 // <etymology>
00061 // This class puts GBT data (fills) into the MSPolarization table.
00062 // </etymology>
00063 //
00064 // <synopsis>
00065 // This class puts the appropriate values for the GBT in an MSPolarization
00066 // table (which has been previously created as part of a MeasurementSet).
00067 // On each fill() any necessary additions to the MSPolarization are made.  
00068 // Currently this depends only on the shape of the data being filled as
00069 // there is not yet any polarization information available from the GBT
00070 // data associated paramters FITS files.  Existing rows are re-used
00071 // whenever possible.
00072 //
00073 // The polarizationId is available to be used by the
00074 // other GBTMS*Fillers as other subtables are filled in turn.
00075 //
00076 // </synopsis>
00077 //
00078 // <example>
00079 // </example>
00080 //
00081 // <motivation>
00082 // Writing a filler is a daunting task.  There are various dependencies
00083 // between the subtables.  It helps to encapsulate the knowlege and
00084 // task of filling a specific subtable to separate classes.
00085 // </motivation>
00086 //
00087 //#! <thrown>
00088 //#! A list of exceptions thrown if errors are discovered in the function.
00089 //#! This tag will appear in the body of the header file, preceding the
00090 //#! declaration of each function which throws an exception.
00091 //#! </thrown>
00092 
00093 class GBTMSPolarizationFiller
00094 {
00095 public:
00096 
00097     // The default ctor.  No MSPolarization table has been attached yet.
00098     // Calling fill on such a filler will throw an exception.
00099     // It is present so that this object can be instantiated before
00100     // an MSPolarization has been created.
00101     GBTMSPolarizationFiller();
00102 
00103     // A filler attached to an MSPolarization table
00104     GBTMSPolarizationFiller(MSPolarization &msPolarization);
00105 
00106     ~GBTMSPolarizationFiller();
00107 
00108     // attach it to an MSPolarization
00109     void attach(MSPolarization &msPolarization);
00110 
00111     // fill - GBT MSPolarization table has one row.
00112     void fill(Int ncorr, const Vector<Int> &corrType, const Matrix<Int> &corrProduct);
00113 
00114     // this is the row number of the most recently "filled" MSPolarization row
00115     // it returns -1 if nothing has been filled yet
00116     Int polarizationId() const {return polarizationId_p;}
00117 
00118     // flush the underlying MS subtable
00119     void flush() {msPolarization_p->flush();}
00120 
00121 private:
00122     ColumnsIndex *index_p;
00123     RecordFieldPtr<Int> ncorrKey_p;
00124     MSPolarization *msPolarization_p;
00125     MSPolarizationColumns *msPolCols_p;
00126 
00127     Int polarizationId_p;
00128 
00129     // initialize the above for the first time
00130     void init(MSPolarization &msPolarization);
00131 
00132     // undefined and unavailable
00133     GBTMSPolarizationFiller(const GBTMSPolarizationFiller &other);
00134     void operator=(const GBTMSPolarizationFiller &other);
00135 };
00136 
00137 #endif
00138 
00139