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