casa
$Rev:20696$
|
00001 //# GBTMSTypeFiller.h: a GBTMSTypeFiller is used to fill the GBT_type table 00002 //# Copyright (C) 2000,2001,2003 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_GBTMSTYPEFILLER_H 00030 #define NRAO_GBTMSTYPEFILLER_H 00031 00032 00033 #include <casa/aips.h> 00034 #include <tables/Tables/Table.h> 00035 #include <casa/BasicSL/String.h> 00036 00037 //# Forward Declarations 00038 namespace casa { //# NAMESPACE CASA - BEGIN 00039 class ColumnsIndex; 00040 class TableRow; 00041 class Record; 00042 class RecordDesc; 00043 template <class T> class Vector; 00044 } //# NAMESPACE CASA - END 00045 00046 #include <casa/namespace.h> 00047 00048 // <summary> 00049 // Used to fill the GBT_type table (e.g. GBT_HOLOGRAPHY or GBT_DCR) 00050 // </summary> 00051 00052 // <use visibility=local> 00053 00054 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00055 // </reviewed> 00056 00057 // <prerequisite> 00058 // <li> <linkto class=GBTBackendFiller>GBTBackendFiller</linkto> 00059 // </prerequisite> 00060 // 00061 // <etymology> 00062 // The PROCESSOR 00063 // </etymology> 00064 // 00065 // <synopsis> 00066 // </synopsis> 00067 // 00068 // <example> 00069 // </example> 00070 // 00071 // <motivation> 00072 // The GBT backend FITS files have keywords which are unhandled by the 00073 // regular filling process. These are backend specific keywords which 00074 // tend to be constant or re-used with time. These values are placed 00075 // in a subtable name GBT_type where type is the type of backend such 00076 // as HOLOGRAPHY, DCR, SPECTRALPROCESSOR or ACS. These are 00077 // indexed directly from the PROCESSOR subtable of MS where TYPE_ID is 00078 // the row into this table. 00079 // </motivation> 00080 // 00081 // <todo asof="yyyy/mm/dd"> 00082 // <li> Is there a mechanism in the Table system which essentially 00083 // already does this? 00084 // </todo> 00085 00086 class GBTMSTypeFiller 00087 { 00088 public: 00089 // open an already existing table - type is extracted from the tableName 00090 // using everything after the last "_". 00091 GBTMSTypeFiller(const String &tableName); 00092 00093 // create a new, empty table attached to the given table using the indicate type. 00094 GBTMSTypeFiller(Table &attachTable, const String &type); 00095 00096 00097 ~GBTMSTypeFiller(); 00098 00099 // fill this record to this table. 00100 // Each field in the record maps to a column in the 00101 // the table. There must be no subrecords. The types 00102 // of the fields must match that in the existing table. 00103 // Fields not already in the table will result in new 00104 // columns for that table. If there are only scalar columns, then new rows 00105 // will only be added if this row does not already exist in the table. 00106 // If there are any non-scalar columns, a new row is always added. 00107 void fill(const Record &other); 00108 00109 // how many rows in this table 00110 uInt nrow() { return tab_p->nrow(); } 00111 00112 // what is the type of this GBT_type table 00113 const String &type() {return type_p;} 00114 00115 // what is the most recent typeId filled 00116 Int typeId() { return typeId_p;} 00117 00118 // flush this table 00119 void flush() { tab_p->flush();} 00120 private: 00121 Table *tab_p; 00122 TableRow *tabRow_p; 00123 00124 ColumnsIndex *index_p; 00125 Int typeId_p; 00126 00127 String type_p; 00128 00129 void updateTableRow(); 00130 void updateIndex(const RecordDesc &other); 00131 void updateIndex(const Vector<String> &colnames); 00132 00133 // this checks the record and adds columns as required 00134 void checkRecord(Record &other); 00135 00136 // Undefined and unavailable 00137 GBTMSTypeFiller(); 00138 GBTMSTypeFiller(const GBTMSTypeFiller &other); 00139 GBTMSTypeFiller &operator=(const GBTMSTypeFiller &other); 00140 }; 00141 00142 00143 #endif 00144 00145