casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
MSHistoryHandler.h
Go to the documentation of this file.
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: MSHistoryHandler.h 18405 2005-02-16 00:13:07Z rrusk $
00027 
00028 
00029 #ifndef MS_MSHISTORYHANDLER_H
00030 #define MS_MSHISTORYHANDLER_H
00031 
00032 #include <ms/MeasurementSets/MeasurementSet.h>
00033 #include <ms/MeasurementSets/MSHistory.h>
00034 
00035 
00036 namespace casa { //# NAMESPACE CASA - BEGIN
00037 
00038 class MSHistoryColumns;
00039 class LogIO;
00040 class LogSinkInterface;
00041 // <summary>
00042 // A class to provide a simple interface to history writing
00043 // </summary>
00044 // <use visibility=local>
00045 // <etymology>
00046 // Handle the history info that needs to be archived in ms
00047 // </etymology>
00048 // <synopsis>
00049 // This class provides access to the MS history via single method calls
00050 // A couple of the simple methods are independent and can be called without 
00051 // constructing.  
00052 // </synopsis>
00053 
00054 class MSHistoryHandler
00055 {
00056 
00057  public: 
00058   //Construct the history handler from an ms
00059   MSHistoryHandler(MeasurementSet& ms, String app="");
00060 
00061   MSHistoryHandler &operator=(MSHistoryHandler &other);
00062   // Destructor
00063   ~MSHistoryHandler();
00064 
00065   
00066 
00067   //Add a string message
00068 
00069   // This method does not need construction ...can be called explicitly 
00070   //
00071   static void addMessage(MeasurementSet& ms, String message,
00072              String app="",
00073              String cliComm="", 
00074              String origin="");
00075 
00076   // Add message and/or CLI command to the history table
00077   void addMessage(String message, String cliComm="", String origin="");
00078   // In this version the LogIO object need to have a valid LogSink with 
00079   // messages in it. 
00080   void addMessage(LogIO& message, String cliComm="");
00081   void addMessage(LogSinkInterface& sink, String cliComm="");
00082 
00083   void cliCommand(String& cliComm);
00084   void cliCommand(LogIO& cliComm);
00085   void cliCommand(LogSinkInterface& sink);
00086 
00087  private: 
00088 
00089   // Prevent use of default constructor
00090   MSHistoryHandler() {};
00091 
00092   MSHistoryColumns *msHistCol_p;
00093   MSHistory  histTable_p;
00094   String application_p;
00095 
00096 };
00097 
00098 
00099 } //# NAMESPACE CASA - END
00100 
00101 #endif