00001 //# MSHistoryHandler: allow simple access to write or read HISTORY subtable 00002 //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This program is free software; you can redistribute it and/or modify 00006 //# it under the terms of the GNU General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or 00008 //# (at your option) any later version. 00009 //# 00010 //# This program is distributed in the hope that it will be useful, 00011 //# but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 //# GNU General Public License for more details. 00014 //# 00015 //# You should have received a copy of the GNU General Public License 00016 //# along with this program; if not, write to the Free Software 00017 //# Foundation, Inc., 675 Mass 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 //# $Id$ 00027 00028 00029 #ifndef MS_MSHISTORYHANDLER_H 00030 #define MS_MSHISTORYHANDLER_H 00031 00032 #include <casacore/casa/aips.h> 00033 #include <casacore/ms/MeasurementSets/MeasurementSet.h> 00034 #include <casacore/ms/MeasurementSets/MSHistory.h> 00035 00036 00037 namespace casacore { //# NAMESPACE CASACORE - BEGIN 00038 00039 class MSHistoryColumns; 00040 class LogIO; 00041 class LogSinkInterface; 00042 // <summary> 00043 // A class to provide a simple interface to history writing 00044 // </summary> 00045 // <use visibility=local> 00046 // <etymology> 00047 // Handle the history info that needs to be archived in ms 00048 // </etymology> 00049 // <synopsis> 00050 // This class provides access to the MS history via single method calls 00051 // A couple of the simple methods are independent and can be called without 00052 // constructing. 00053 // </synopsis> 00054 00055 class MSHistoryHandler 00056 { 00057 00058 public: 00059 //Construct the history handler from an ms 00060 MSHistoryHandler(MeasurementSet& ms, String app=""); 00061 00062 MSHistoryHandler &operator=(MSHistoryHandler &other); 00063 // Destructor 00064 ~MSHistoryHandler(); 00065 00066 00067 00068 //Add a string message 00069 00070 // This method does not need construction ...can be called explicitly 00071 // 00072 static void addMessage(MeasurementSet& ms, String message, 00073 String app="", 00074 String cliComm="", 00075 String origin=""); 00076 00077 // Add message and/or CLI command to the history table 00078 void addMessage(String message, String cliComm="", String origin=""); 00079 // In this version the LogIO object need to have a valid LogSink with 00080 // messages in it. 00081 void addMessage(LogIO& message, String cliComm=""); 00082 void addMessage(LogSinkInterface& sink, String cliComm=""); 00083 00084 void cliCommand(String& cliComm); 00085 void cliCommand(LogIO& cliComm); 00086 void cliCommand(LogSinkInterface& sink); 00087 00088 private: 00089 00090 // Prevent use of default constructor 00091 MSHistoryHandler() {} 00092 00093 MSHistoryColumns *msHistCol_p; 00094 MSHistory histTable_p; 00095 String application_p; 00096 00097 }; 00098 00099 00100 } //# NAMESPACE CASACORE - END 00101 00102 #endif