casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
SDHistoryHandler.h
Go to the documentation of this file.
00001 //# SDHistoryFiller.h: fills the HISTORY 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: SDHistoryHandler.h 18700 2005-05-23 07:45:13Z cvsmgr $
00028 
00029 #ifndef MS_SDHISTORYHANDLER_H
00030 #define MS_SDHISTORYHANDLER_H
00031 
00032 #include <casa/Containers/RecordField.h>
00033 
00034 namespace casa { //# NAMESPACE CASA - BEGIN
00035 
00036 //# Forward Declarations
00037 class MeasurementSet;
00038 class MSHistory;
00039 class MSHistoryColumns;
00040 class Record;
00041 
00042 template <class T> class Vector;
00043 
00044 // <summary>
00045 // </summary>
00046 
00047 // <use visibility=local>   or   <use visibility=export>
00048 
00049 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00050 // </reviewed>
00051 
00052 // <prerequisite>
00053 //   <li> SomeClass
00054 //   <li> SomeOtherClass
00055 //   <li> some concept
00056 // </prerequisite>
00057 //
00058 // <etymology>
00059 // </etymology>
00060 //
00061 // <synopsis>
00062 // </synopsis>
00063 //
00064 // <example>
00065 // </example>
00066 //
00067 // <motivation>
00068 // </motivation>
00069 //
00070 // <templating arg=T>
00071 //    <li>
00072 //    <li>
00073 // </templating>
00074 //
00075 // <thrown>
00076 //    <li>
00077 //    <li>
00078 // </thrown>
00079 //
00080 // <todo asof="yyyy/mm/dd">
00081 //   <li> add this feature
00082 //   <li> fix this bug
00083 //   <li> start discussion of this possible extension
00084 // </todo>
00085 
00086 class SDHistoryHandler
00087 {
00088 public:
00089     // default ctor is not attached to a MS and hence is useless until attached
00090     SDHistoryHandler();
00091 
00092     // attach this to a MS - no columns are explicitly handled here
00093     SDHistoryHandler(MeasurementSet &ms, const Vector<Bool> &handledCols, const Record &row);
00094 
00095     // copy ctor
00096     SDHistoryHandler(const SDHistoryHandler &other);
00097 
00098     ~SDHistoryHandler() {clearAll();}
00099 
00100     // assignment operator, uses copy semantics
00101     SDHistoryHandler &operator=(const SDHistoryHandler &other);
00102 
00103     // attach to a MS
00104     void attach(MeasurementSet &ms, Vector<Bool> &handledCols, const Record &row);
00105 
00106     // reset internals given indicated row, use the same MS
00107     void resetRow(const Record &row);
00108 
00109     // fill - a new row is added on each call, the message time stamp is the current time
00110     void fill(const Record& row, Int observationId,
00111               const String &message, const String &priority);
00112 private:
00113     MSHistory *msHis_p;
00114     MSHistoryColumns *msHisCols_p;
00115 
00116     // TIMESYS field pointer when available
00117     RORecordFieldPtr<String> timesys_p;
00118 
00119     // cleanup everything
00120     void clearAll();
00121 
00122     // clean up row-dependent stuff
00123     void clearRow();
00124 
00125     // initialize everything
00126     void initAll(MeasurementSet &ms, const Vector<Bool> &handledCols, const Record &row);
00127 
00128     // initialize stuff which depends on the row
00129     void initRow(const Vector<Bool> &handledCols, const Record &row);
00130 };
00131 
00132 
00133 } //# NAMESPACE CASA - END
00134 
00135 #endif