casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
GBTMSWeatherCopier.h
Go to the documentation of this file.
00001 //# GBTMSWeatherCopier.h: GBTMSWeatherCopier copies Weather DAP fields to a MSWeather table
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 NRAO_GBTMSWEATHERCOPIER_H
00030 #define NRAO_GBTMSWEATHERCOPIER_H
00031 
00032 #include <casa/aips.h>
00033 #include <casa/Containers/RecordField.h>
00034 #include <tables/Tables/TableColumn.h>
00035 
00036 //# Forward Declarations
00037 namespace casa { //# NAMESPACE CASA - BEGIN
00038 class CopyRecordToTable;
00039 class Record;
00040 class String;
00041 class MVTime;
00042 class MSWeather;
00043 class MSWeatherColumns;
00044 class TableDesc;
00045 } //# NAMESPACE CASA - END
00046 
00047 #include <casa/namespace.h>
00048 
00049 // <summary>
00050 // GBTMSWeatherCopier copies Weather DAP fields toa  MSWeather table
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 //   <li> GBTMSWeatherFiller
00062 // </prerequisite>
00063 //
00064 // <etymology>
00065 // This class copies GBT Weather DAP into the MSWeather table.
00066 // </etymology>
00067 //
00068 // <synopsis>
00069 // This class puts the appropriate values for the GBT in an MSWeather
00070 // table (which has been previously created as part of a MeasurementSet).
00071 // On each fill() any necessary additions to the MSWeather are made.
00072 // Because it works with the Weather FITS files in the same way that
00073 // the generic DAP copiers must work with multiple samplers and
00074 // managers, this class was derived from GBTDAPCopierBase.
00075 // </synopsis>
00076 //
00077 // <example>
00078 // </example>
00079 //
00080 // <motivation>
00081 // Writing a copier is a daunting task.  There are various dependencies
00082 // between the subtables.  It helps to encapsulate the knowlege and
00083 // task of filling a specific subtable to separate classes.
00084 // </motivation>
00085 //
00086 //#! <thrown>
00087 //#! A list of exceptions thrown if errors are discovered in the function.
00088 //#! This tag will appear in the body of the header file, preceding the
00089 //#! declaration of each function which throws an exception.
00090 //#! </thrown>
00091 
00092 class GBTMSWeatherCopier
00093 {
00094 public:
00095     // construct the copier given the MSWeather table and the record which
00096     // will contain the DAP fields to be copied.  Supply the DAP TableDesc and ID for this copier.
00097     GBTMSWeatherCopier(MSWeather &msWeather, const Record &weatherRecord, 
00098                        const TableDesc &td, Int id);
00099 
00100     ~GBTMSWeatherCopier();
00101 
00102     // copy the current contents to indicated row of the table, which must have already
00103     // been added to the weather table
00104     void copy(uInt toRow, const String &sampler, const String &manager,
00105               const MVTime &time, Double interval, Int antennaId);
00106 
00107     // re-initialize things to use the indicate Record, TableDesc and Id
00108     void reinit(const Record &weatherRecord, const TableDesc &td, Int id);
00109 
00110 private:
00111     MSWeather *msWeather_p;
00112     MSWeatherColumns *msWeatherCols_p;
00113 
00114     // sampler and manager
00115     TableColumn samplerCol_p, managerCol_p;
00116 
00117     Int id_p;
00118 
00119     // standard fields with standard MSColumns to receive them
00120     RORecordFieldPtr<Float> windVelField_p, windDirField_p, ambTempField_p, pressureField_p,
00121         dewPointField_p;
00122 
00123     // flags indicating which fields are actually present in this copier
00124     Bool hasWindVel_p, hasWindDir_p, hasAmbTemp_p, hasPressure_p, hasDewPoint_p;
00125 
00126     // the copier for everything else
00127     CopyRecordToTable *fieldCopier_p;
00128 
00129     void cleanup();
00130 
00131     void detachFields();
00132 
00133    // undefined and unavailable
00134     GBTMSWeatherCopier(const GBTMSWeatherCopier &other);
00135     void operator=(const GBTMSWeatherCopier &other);
00136 };
00137 
00138 #endif
00139 
00140