SDSpWinHandler.h

Go to the documentation of this file.
00001 //# SDSpWindowFiller.h: fills the SPECTRAL_WINDOW table for the SDFITS filler
00002 //# Copyright (C) 2000,2001,2002
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 MS_SDSPWINHANDLER_H
00030 #define MS_SDSPWINHANDLER_H
00031 
00032 #include <casacore/casa/aips.h>
00033 #include <casacore/casa/Arrays/Vector.h>
00034 #include <casacore/casa/Containers/RecordField.h>
00035 #include <casacore/tables/Tables/TableColumn.h>
00036 
00037 namespace casacore { //# NAMESPACE CASACORE - BEGIN
00038 
00039 //# Forward Declarations
00040 class ColumnsIndex;
00041 class MeasurementSet;
00042 class MSSpectralWindow;
00043 class MSSpWindowColumns;
00044 class Record;
00045 class Table;
00046 
00047 // <summary>
00048 // </summary>
00049 
00050 // <use visibility=local>   or   <use visibility=export>
00051 
00052 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00053 // </reviewed>
00054 
00055 // <prerequisite>
00056 //   <li> SomeClass
00057 //   <li> SomeOtherClass
00058 //   <li> some concept
00059 // </prerequisite>
00060 //
00061 // <etymology>
00062 // </etymology>
00063 //
00064 // <synopsis>
00065 // </synopsis>
00066 //
00067 // <example>
00068 // </example>
00069 //
00070 // <motivation>
00071 // </motivation>
00072 //
00073 // <templating arg=T>
00074 //    <li>
00075 //    <li>
00076 // </templating>
00077 //
00078 // <thrown>
00079 //    <li>
00080 //    <li>
00081 // </thrown>
00082 //
00083 // <todo asof="yyyy/mm/dd">
00084 //   <li> add this feature
00085 //   <li> fix this bug
00086 //   <li> start discussion of this possible extension
00087 // </todo>
00088 
00089 class SDSpWindowHandler
00090 {
00091 public:
00092     // default ctor is not attached to a MS and hence is useless until attached
00093     SDSpWindowHandler();
00094 
00095     // attach this to a MS, marking fields in row which are explicitly handled here
00096     SDSpWindowHandler(MeasurementSet &ms, Vector<Bool> &handledCols, const Record &row);
00097 
00098     // copy ctor
00099     SDSpWindowHandler(const SDSpWindowHandler &other);
00100 
00101     ~SDSpWindowHandler() {clearAll();}
00102 
00103     // assignment operator, uses copy semantics
00104     SDSpWindowHandler &operator=(const SDSpWindowHandler &other);
00105 
00106     // attach to a MS, the handledCols and row arguments are ignored here
00107     void attach(MeasurementSet &ms, Vector<Bool> &handledCols, const Record &row);
00108 
00109     // reset internals given indicated row, use the same MS; just resets the id pointer
00110     void resetRow(const Record &);
00111     
00112     // fill - a circular buffer of last 100 spectral windows is checked
00113     void fill(const Record &row, const Vector<Double> &frequency, Double refFrequency,
00114               Double originalFreqDelt, Int freqRefType);
00115 
00116     // get the current spWindow ID
00117     Int spWindowId() {return rownr_p;}
00118 private:
00119     RecordFieldPtr<Int> nchanKey_p, freqRefTypeKey_p, ifConvChainKey_p,
00120         freqGroupKey_p, netSidebandKey_p;
00121     Vector<Double> fNCache_p, f0Cache_p, bwCache_p;
00122     Double *fNCachePtr_p, *f0CachePtr_p, *bwCachePtr_p;
00123     Bool deleteItFN_p, deleteItF0_p, deleteItBw_p;
00124     RecordFieldPtr<Bool> flagRowKey_p;
00125     // the cache table is the one that is indexed
00126     ColumnsIndex *index_p;
00127     // temporary table to hold the fields we are indexing on, can't index on array column
00128     Table *theCache_p;
00129     MSSpectralWindow *msSpWin_p;
00130     MSSpWindowColumns *msSpWinCols_p;
00131 
00132     // the columns in the cache table
00133     TableColumn idCol_p, nchanCol_p, freqRefTypeCol_p, 
00134         freqresCol_p, ifConvChainCol_p,
00135         freqGroupCol_p, netSidebandCol_p, flagRowCol_p;
00136 
00137     // the next row number to use in the cached
00138     uInt nextCacheRow_p;
00139 
00140     // the maximum number of rows in the cache - currently this is 1000
00141     uInt cacheSize_p;
00142 
00143     // the current row number in the SPECTRAL_WINDOW table, i.e. the id
00144     Int rownr_p;
00145 
00146     // fields possibly mined from the SDFITS row
00147     // floating point fields that we can't be certain of their type
00148     Int bandwidField_p, freqresField_p;
00149 
00150     // fields from a previous life as a MS
00151     RORecordFieldPtr<Int> spWinIdField_p, ifConvChainField_p, freqGroupField_p,
00152         netSidebandField_p;
00153     RORecordFieldPtr<Bool> flagRowField_p;
00154 
00155     // cleanup everything
00156     void clearAll();
00157 
00158     // clean up items related to the row
00159     void clearRow();
00160 
00161     // initialize everything
00162     void initAll(MeasurementSet &ms, Vector<Bool> &handledCols, const Record &row);
00163 
00164     // initialize the stuff dependent on the row
00165     void initRow(Vector<Bool> &handledCols, const Record &row);
00166 };
00167 
00168 
00169 } //# NAMESPACE CASACORE - END
00170 
00171 #endif
00172 
00173 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1