casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
GBTMSWeatherFiller.h
Go to the documentation of this file.
00001 //# GBTMSWeatherFiller.h: GBTMSWeatherFiller fills the MSWeather 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_GBTMSWEATHERFILLER_H
00030 #define NRAO_GBTMSWEATHERFILLER_H
00031 
00032 #include <casa/aips.h>
00033 #include <casa/Containers/Block.h>
00034 #include <nrao/GBTFillers/GBTDAPFillerBase.h>
00035 #include <tables/Tables/TableColumn.h>
00036 #include <ms/MeasurementSets/MSWeather.h>
00037 
00038 //# Forward Declarations
00039 namespace casa { //# NAMESPACE CASA - BEGIN
00040 class MSWeather;
00041 class MVTime;
00042 class String;
00043 } //# NAMESPACE CASA - END
00044 
00045 #include <casa/namespace.h>
00046 
00047 class GBTMSWeatherCopier;
00048 
00049 // <summary>
00050 // GBTMSWeatherFiller fills the MSWeather table for GBT fillers
00051 // </summary>
00052 
00053 // <use visibility=local>
00054 
00055 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00056 // </reviewed>
00057 
00058 // <prerequisite>
00059 //   <li> MeasurementSets
00060 //   <li> GBT FITS files
00061 // </prerequisite>
00062 //
00063 // <etymology>
00064 // This class puts GBT data (fills) into the MSWeather table.
00065 // </etymology>
00066 //
00067 // <synopsis>
00068 // This class puts the appropriate values for the GBT in an MSWeather
00069 // table (which has been previously created as part of a MeasurementSet).
00070 // On each fill() any necessary additions to the MSWeather are made.
00071 // Because it works with the Weather FITS files in the same way that
00072 // the generic DAP fillers must work with multiple samplers and
00073 // managers, this class was derived from GBTDAPFillerBase.
00074 // </synopsis>
00075 //
00076 // <example>
00077 // </example>
00078 //
00079 // <motivation>
00080 // Writing a filler is a daunting task.  There are various dependencies
00081 // between the subtables.  It helps to encapsulate the knowlege and
00082 // task of filling a specific subtable to separate classes.
00083 // </motivation>
00084 //
00085 //#! <thrown>
00086 //#! A list of exceptions thrown if errors are discovered in the function.
00087 //#! This tag will appear in the body of the header file, preceding the
00088 //#! declaration of each function which throws an exception.
00089 //#! </thrown>
00090 
00091 class GBTMSWeatherFiller : public GBTDAPFillerBase
00092 {
00093 public:
00094 
00095     // The default ctor.  No MSWeather table has been attached yet.
00096     // Calling fill on such a filler will throw an exception.
00097     // It is present so that this object can be instantiated before
00098     // an MSWeather has been created.
00099     GBTMSWeatherFiller();
00100 
00101     // A filler attached to an MSWeather table
00102     GBTMSWeatherFiller(MSWeather &msWeather);
00103 
00104     ~GBTMSWeatherFiller();
00105 
00106     const String &device() const {return device_p;}
00107 
00108     // attach it to an MSWeather
00109     void attach(MSWeather &msWeather);
00110 
00111     // prepare for filling the indicated weather file
00112     Int prepare(const String &fileName, const String &manager,
00113                 const String &sampler, const MVTime &startTime);
00114 
00115     // set the antennaId - defaults to -1 if not explicitly set
00116     void setAntennaId(Int antennaId) {antennaId_p = antennaId;}
00117 
00118     // fill what has been prepared
00119     void fill();
00120 
00121     // flush the underlying MS subtable
00122     void flush() {msWeather_p->flush();}
00123 
00124 private:
00125     String device_p;
00126 
00127     MSWeather *msWeather_p;
00128 
00129     // sampler and manager
00130     TableColumn samplerCol_p, managerCol_p;
00131 
00132     // copiers - one for each 
00133     PtrBlock<GBTMSWeatherCopier *> copiers_p;
00134     // and how many of them are really in use at any given point
00135     Int ndap_p;
00136 
00137     Int antennaId_p;
00138 
00139     // initialize the above for the first time
00140     void init(MSWeather &msWeather);
00141 
00142     // undefined and unavailable
00143     GBTMSWeatherFiller(const GBTMSWeatherFiller &other);
00144     void operator=(const GBTMSWeatherFiller &other);
00145 };
00146 
00147 #endif
00148 
00149