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