casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
LogFilterInterface.h
Go to the documentation of this file.
00001 //# LogFilterInterface.h: Abstract base class for filtering LogMessages
00002 //# Copyright (C) 1996,2000,2003
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: LogFilterInterface.h 20551 2009-03-25 00:11:33Z Malte.Marquarding $
00028 
00029 #ifndef CASA_LOGFILTERINTERFACE_H
00030 #define CASA_LOGFILTERINTERFACE_H
00031 
00032 //# Includes
00033 #include <casa/aips.h>
00034 #include <casa/Logging/LogMessage.h>
00035 
00036 
00037 namespace casa { //# NAMESPACE CASA - BEGIN
00038 
00039 // <summary>
00040 // Abstract base class for filtering LogMessages.
00041 // </summary>
00042 
00043 // <use visibility=local>
00044 
00045 // <reviewed reviewer="wbrouw" date="1996/08/21" tests="" demos="dLogging.cc" tests="tLogging.cc">
00046 // </reviewed>
00047 
00048 // <prerequisite>
00049 //   <li> <linkto class="LogMessage">LogMessage</linkto>
00050 // </prerequisite>
00051 //
00052 // <etymology>
00053 // Log[Message] Filter.
00054 // </etymology>
00055 //
00056 // <synopsis>
00057 // The <src>LogFilter</src> class is used by the various log sink classes,
00058 // typically accessed through <linkto class="LogSink">LogSink</linkto>, to
00059 // decide whether a particular <linkto class="LogMessage">LogMessage</linkto>
00060 // should be accepted or rejected.
00061 //
00062 // Simple filtering is based on the messages priority.
00063 // In particular, you typically will choose to only pass messages greater
00064 // than or equal to  <src>NORMAL</src> in priority, but you might choose
00065 // <src>DEBUGGING</src> to see all messages, or <src>SEVERE</src> to only see
00066 // messages that report serious problems.
00067 // </synopsis>
00068 //
00069 // <example>
00070 // Suppose we wanted to change the global sink so that it prints all messages,
00071 // including debugging messages:
00072 // <srcblock>
00073 // LogFilter all(LogMessage::DEBUGGING);
00074 // LogSink::globalSink().filter(all);
00075 // </srcblock>
00076 // </example>
00077 //
00078 // <motivation>
00079 // </motivation>
00080 //
00081 //# <todo asof="1996/07/23">
00082 //# </todo>
00083 
00084 class LogFilterInterface
00085 {
00086 public:
00087   // Construct a filter with the LOWEST priority that you want passed.  Thus
00088   // <src>DEBUGGING</src> passes everything. Note that it is not possible to
00089   // block <src>SEVERE</src> level messages, although you can use a
00090   // <linkto class="NullLogSink">NullLogSink</linkto> which will have
00091   // this effect.
00092   LogFilterInterface()
00093     {}
00094 
00095   virtual ~LogFilterInterface();
00096 
00097   // Clone the object.
00098   virtual LogFilterInterface* clone() const = 0;
00099 
00100   // Return True if <src>message</src> passes this filter.
00101   virtual Bool pass (const LogMessage& message) const = 0;
00102 
00103 private:
00104   // Copy constructor and assignment cannot be used.
00105   // <group>
00106   LogFilterInterface (const LogFilterInterface& other);
00107   LogFilterInterface& operator= (const LogFilterInterface& other);
00108   // </group>
00109 };
00110 
00111 
00112 
00113 } //# NAMESPACE CASA - END
00114 
00115 #endif