SDObservationHandler.h

Go to the documentation of this file.
00001 //# SDObservationFiller.h: fills the OBSERVATION table for the SDFITS filler
00002 //# Copyright (C) 2000
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_SDOBSERVATIONHANDLER_H
00030 #define MS_SDOBSERVATIONHANDLER_H
00031 
00032 #include <casacore/casa/aips.h>
00033 #include <casacore/casa/Containers/RecordField.h>
00034 #include <casacore/tables/Tables/ScalarColumn.h>
00035 
00036 namespace casacore { //# NAMESPACE CASACORE - BEGIN
00037 
00038 //# Forward Declarations
00039 class ColumnsIndex;
00040 class MeasurementSet;
00041 class MSObservation;
00042 class MSObservationColumns;
00043 class Record;
00044 class String;
00045 
00046 template <class T> class Vector;
00047 
00048 // <summary>
00049 // </summary>
00050 
00051 // <use visibility=local>   or   <use visibility=export>
00052 
00053 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00054 // </reviewed>
00055 
00056 // <prerequisite>
00057 //   <li> SomeClass
00058 //   <li> SomeOtherClass
00059 //   <li> some concept
00060 // </prerequisite>
00061 //
00062 // <etymology>
00063 // </etymology>
00064 //
00065 // <synopsis>
00066 // </synopsis>
00067 //
00068 // <example>
00069 // </example>
00070 //
00071 // <motivation>
00072 // </motivation>
00073 //
00074 // <templating arg=T>
00075 //    <li>
00076 //    <li>
00077 // </templating>
00078 //
00079 // <thrown>
00080 //    <li>
00081 //    <li>
00082 // </thrown>
00083 //
00084 // <todo asof="yyyy/mm/dd">
00085 //   <li> add this feature
00086 //   <li> fix this bug
00087 //   <li> start discussion of this possible extension
00088 // </todo>
00089 
00090 class SDObservationHandler
00091 {
00092 public:
00093     // default ctor is not attached to a MS and hence is useless until attached
00094     SDObservationHandler();
00095 
00096     // attach this to a MS, mark the appropriate columns as handled given
00097     // the indicated row
00098     SDObservationHandler(MeasurementSet &ms, Vector<Bool> &handledCols, const Record &row);
00099 
00100     // copy ctor
00101     SDObservationHandler(const SDObservationHandler &other);
00102 
00103     ~SDObservationHandler() {clearAll();}
00104 
00105     // assignment operator, uses copy semantics
00106     SDObservationHandler &operator=(const SDObservationHandler &other);
00107 
00108     // attach to a MS, mark the appropriate columns as handled given the row
00109     void attach(MeasurementSet &ms, Vector<Bool> &handledCols, const Record &row);
00110 
00111     // reset internals given indicated row, use the same MS 
00112     void resetRow(const Record &row);
00113     
00114     // fill - a new row is added only when necessary
00115     void fill(const Record &row, const String &telescopeName, const Vector<Double> &timeRange);
00116 
00117     // get the current observation ID
00118     Int observationId() {return rownr_p;}
00119 
00120     // update the time range
00121     void updateTimeRange(const Vector<Double> &timeRange);
00122 private:
00123     ColumnsIndex *index_p;
00124     RecordFieldPtr<String> telescopeKey_p, observerKey_p, projectKey_p, ns_obsidKey_p;
00125     RecordFieldPtr<Double> releaseDateKey_p;
00126     RecordFieldPtr<Bool> flagRowKey_p;
00127 
00128     MSObservation *msObs_p;
00129     MSObservationColumns *msObsCols_p;
00130 
00131     Int rownr_p;
00132 
00133     ScalarColumn<String> nsObsIdCol_p;
00134 
00135     // pointers to fields in record, only used if attached
00136     RORecordFieldPtr<String> observer_p, projid_p, obsid_p;
00137     RORecordFieldPtr<Double> releaseDate_p;
00138     RORecordFieldPtr<Bool> flagRow_p;
00139     RORecordFieldPtr<Array<Double> > timeRange_p;
00140 
00141     // cleanup everything
00142     void clearAll();
00143 
00144     // cleanup things which depend on the row description being fixed
00145     void clearRow();
00146 
00147     // initialize everything
00148     void initAll(MeasurementSet &ms, Vector<Bool> &handledCols, const Record &row);
00149 
00150     // initialize the things which depend on the row
00151     void initRow(Vector<Bool> &handledCols, const Record &row);
00152 
00153     // initialize the index
00154     void makeIndex();
00155 };
00156 
00157 
00158 } //# NAMESPACE CASACORE - END
00159 
00160 #endif
00161 
00162 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1