casa
$Rev:20696$
|
00001 //# GBTMSObservationFiller.h: GBTMSObservationFiller fills the MSObservation 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_GBTMSOBSERVATIONFILLER_H 00030 #define NRAO_GBTMSOBSERVATIONFILLER_H 00031 00032 #include <casa/aips.h> 00033 #include <casa/BasicSL/String.h> 00034 #include <ms/MeasurementSets/MSObservation.h> 00035 00036 //# Forward Declarations 00037 namespace casa { //# NAMESPACE CASA - BEGIN 00038 class MSObservationColumns; 00039 class MVTime; 00040 } //# NAMESPACE CASA - END 00041 00042 #include <casa/namespace.h> 00043 00044 // <summary> 00045 // GBTMSObservationFiller fills the MSObservation table for GBT fillers 00046 // </summary> 00047 00048 // <use visibility=local> 00049 00050 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00051 // </reviewed> 00052 00053 // <prerequisite> 00054 // <li> MeasurementSets 00055 // <li> GBT FITS files 00056 // </prerequisite> 00057 // 00058 // <etymology> 00059 // This class puts GBT data (fills) into the MSObservation table. 00060 // </etymology> 00061 // 00062 // <synopsis> 00063 // This class puts the appropriate values for the GBT in an MSObservation 00064 // table (which has been previously created as part of a MeasurementSet). 00065 // On each fill() any necessary additions to the MSObservation are made. 00066 // Each fill() adds a new row to the MSObservation table. 00067 // 00068 // The observationId is available to be used by 00069 // other GBTMS*Fillers as other subtables are filled in turn. 00070 // 00071 // </synopsis> 00072 // 00073 // <example> 00074 // </example> 00075 // 00076 // <motivation> 00077 // Writing a filler is a daunting task. There are various dependencies 00078 // between the subtables. It helps to encapsulate the knowlege and 00079 // task of filling a specific subtable to separate classes. 00080 // </motivation> 00081 // 00082 //#! <thrown> 00083 //#! A list of exceptions thrown if errors are discovered in the function. 00084 //#! This tag will appear in the body of the header file, preceding the 00085 //#! declaration of each function which throws an exception. 00086 //#! </thrown> 00087 00088 class GBTMSObservationFiller 00089 { 00090 public: 00091 00092 // The default ctor. No MSObservation table has been attached yet. 00093 // Calling fill on such a filler will throw an exception. 00094 // It is present so that this object can be instantiated before 00095 // an MSObservation has been created. 00096 GBTMSObservationFiller(); 00097 00098 // A filler attached to an MSObservation table 00099 GBTMSObservationFiller(MSObservation &msObservation); 00100 00101 ~GBTMSObservationFiller(); 00102 00103 // attach it to an MSObservation 00104 void attach(MSObservation &msObservation); 00105 00106 // fill - adds a new row to the observation table whenever project, 00107 // observer or telescope, changes. 00108 // other content to add will be added here as it becomes available 00109 // e.g. OBS_SCHEDULE 00110 // The timestamp and duration are used to adjust that TIME_RANGE so that 00111 // the current project row extends at least from timestamp to 00112 // timestamp+duration. 00113 void fill(const String &project, const String &observer, 00114 const MVTime ×tamp, Double duration, 00115 const String &telescope); 00116 00117 // this is the row number of the most recently "filled" MSObservation row 00118 // it returns -1 if nothing has been filled yet 00119 Int observationId() const {return observationId_p;} 00120 00121 // its easier to just cache the most recent project here 00122 const String &project() const {return project_p;} 00123 00124 // flush the underlying MS subtable 00125 void flush() {msObservation_p->flush();} 00126 00127 private: 00128 MSObservation *msObservation_p; 00129 MSObservationColumns *msObsCols_p; 00130 00131 Int observationId_p; 00132 String project_p; 00133 String observer_p; 00134 String telescope_p; 00135 00136 // initialize the above for the first time 00137 void init(MSObservation &msObservation); 00138 00139 // undefined and unavailable 00140 GBTMSObservationFiller(const GBTMSObservationFiller &other); 00141 void operator=(const GBTMSObservationFiller &other); 00142 }; 00143 00144 #endif 00145 00146