casa
$Rev:20696$
|
00001 //# GBTMSTypeDataFiller.h: this is used to fill the GBT_type_DATA 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_GBTMSTYPEDATAFILLER_H 00030 #define NRAO_GBTMSTYPEDATAFILLER_H 00031 00032 00033 #include <casa/aips.h> 00034 #include <tables/Tables/ScalarColumn.h> 00035 #include <tables/Tables/Table.h> 00036 #include <casa/BasicSL/String.h> 00037 00038 //# Forward Declarations 00039 namespace casa { //# NAMESPACE CASA - BEGIN 00040 class ColumnsIndex; 00041 class TableRow; 00042 class Record; 00043 } //# NAMESPACE CASA - END 00044 00045 #include <casa/namespace.h> 00046 00047 // <summary> 00048 // Used to fill the GBT_type_DATA table (e.g. GBT_HOLOGRAPHY_DATA) 00049 // </summary> 00050 00051 // <use visibility=local> 00052 00053 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00054 // </reviewed> 00055 00056 // <prerequisite> 00057 // <li> <linkto class=GBTBackendFiller>GBTBackendFiller</linkto> 00058 // </prerequisite> 00059 // 00060 // <etymology> 00061 // The PROCESSOR 00062 // </etymology> 00063 // 00064 // <synopsis> 00065 // </synopsis> 00066 // 00067 // <example> 00068 // </example> 00069 // 00070 // <motivation> 00071 // The GBT backend FITS DATA tables have columns which are unhandled by the 00072 // regular filling process. These columns are placed 00073 // in a subtable name GBT_type)DATA where type is the type of backend such 00074 // as HOLOGRAPHY, DCR, SPECTRALPROCESSOR or ACS. These are indexed 00075 // using the TYPE_ID value from the PROCESSOR table. They also have TIME 00076 // and INTERVAL keys. 00077 // </motivation> 00078 // 00079 // <todo asof="yyyy/mm/dd"> 00080 // <li> Some of the mechanisms here are shared with GBTSimpleTable and GBTMSTypeFiller. 00081 // They should share code where possible. 00082 // </todo> 00083 00084 class GBTMSTypeDataFiller 00085 { 00086 public: 00087 // open an already existing table - type is extracted from the tableName 00088 // using everything after the second to last "_". 00089 GBTMSTypeDataFiller(const String &tableName); 00090 00091 // create a new, empty table attached to the given table using 00092 // the indicate typeData. 00093 GBTMSTypeDataFiller(Table &attachTable, const String &type); 00094 00095 ~GBTMSTypeDataFiller(); 00096 00097 // fill this record to this table. 00098 // Each field in the record maps to a column in the 00099 // the table. There must be no subrecords. The type 00100 // of the fields must match that in the existing table. 00101 // Fields not already in the table will result in new 00102 // columns for that table. A new row is always added. 00103 void fill(const Record &row, Double time, Double interval, Int typeId); 00104 00105 // how many rows in this table 00106 uInt nrow() { return tab_p->nrow(); } 00107 00108 // what is the type of this GBT_type_DATA table 00109 const String &type() {return type_p;} 00110 00111 // flush this table 00112 void flush() { tab_p->flush();} 00113 private: 00114 Table *tab_p; 00115 TableRow *tabRow_p; 00116 00117 String type_p; 00118 00119 ScalarColumn<Int> typeIdCol_p; 00120 ScalarColumn<Double> timeCol_p, intervalCol_p; 00121 00122 void updateTableRow(); 00123 00124 // this checks the record and adds columns as required 00125 void checkRecord(const Record &other); 00126 00127 // Undefined and unavailable 00128 GBTMSTypeDataFiller(); 00129 GBTMSTypeDataFiller(const GBTMSTypeDataFiller &other); 00130 GBTMSTypeDataFiller &operator=(const GBTMSTypeDataFiller &other); 00131 }; 00132 00133 00134 #endif 00135 00136