casa
$Rev:20696$
|
00001 //# GBTMSFieldFiller.h: fills the FIELD 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_GBTMSFIELDFILLER_H 00030 #define NRAO_GBTMSFIELDFILLER_H 00031 00032 #include <casa/aips.h> 00033 #include <casa/Containers/RecordField.h> 00034 #include <casa/BasicSL/String.h> 00035 #include <ms/MeasurementSets/MSField.h> 00036 00037 //# Forward Declarations 00038 namespace casa { //# NAMESPACE CASA - BEGIN 00039 class MSFieldColumns; 00040 class MDirection; 00041 class MeasFrame; 00042 class ColumnsIndex; 00043 } //# NAMESPACE CASA - END 00044 00045 #include <casa/namespace.h> 00046 00047 // <summary> 00048 // GBTMSFieldFiller fills the MSField table for GBT fillers 00049 // </summary> 00050 00051 // <use visibility=local> 00052 00053 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00054 // </reviewed> 00055 00056 // <prerequisite> 00057 // <li> MeasurementSets 00058 // <li> GBT FITS files 00059 // </prerequisite> 00060 // 00061 // <etymology> 00062 // This class puts GBT data (fills) into the MSField table. 00063 // </etymology> 00064 // 00065 // <synopsis> 00066 // This class puts the appropriate values for the GBT in an MSField 00067 // table (which has been previously created as part of a MeasurementSet). 00068 // On each fill() any necessary additions to the MSField are made. 00069 // This is fully indexed. New rows are only added for each new NAME, 00070 // CODE, NUM_POLY, SOURCE_ID combination or when the directions change 00071 // for an existing such combination. 00072 // 00073 // The fieldId is available to be used by 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 GBTMSFieldFiller 00094 { 00095 public: 00096 00097 // The default ctor. No MSField 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 MSField has been created. 00101 GBTMSFieldFiller(); 00102 00103 // A filler attached to an MSField table 00104 GBTMSFieldFiller(MSField &msField); 00105 00106 ~GBTMSFieldFiller(); 00107 00108 // attach it to an MSField 00109 void attach(MSField &msField); 00110 00111 // fill, adding rows as necessary, fieldDir is the nominal pointing direction 00112 // at equinox. DELAY_DIR, PHASE_DIR, and REFERENCE_DIR are 00113 // set to the fieldDir value. These are always in J2000 in the MS. 00114 void fill(Int sourceId, const String &name, const MDirection &fieldDir); 00115 00116 // this is the row numbers of the most recently filled MSField row 00117 // it returns -1 if nothing has been filled yet 00118 const Int &fieldId() const {return fieldId_p;} 00119 00120 // flush the underlying MS subtable 00121 void flush() {msField_p->flush();} 00122 00123 private: 00124 ColumnsIndex *index_p; 00125 RecordFieldPtr<String> nameKey_p; 00126 RecordFieldPtr<Int> sourceIdKey_p; 00127 RecordFieldPtr<Double> timeKey_p; 00128 MSField *msField_p; 00129 MSFieldColumns *msFieldCols_p; 00130 00131 Int fieldId_p; 00132 00133 // initialize the above for the first time 00134 void init(MSField &msField); 00135 00136 // undefined and unavailable 00137 GBTMSFieldFiller(const GBTMSFieldFiller &other); 00138 void operator=(const GBTMSFieldFiller &other); 00139 }; 00140 00141 #endif 00142 00143