casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LogFilterTaql.h
Go to the documentation of this file.
1 //# LogFilterTaql.h: Filter LogMessages using a TaQL expression
2 //# Copyright (C) 1996,2000,2003
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //#
27 //# $Id$
28 
29 #ifndef TABLES_LOGFILTERTAQL_H
30 #define TABLES_LOGFILTERTAQL_H
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 //# Forward Declarations
39 class LogFilterExpr;
40 
41 
42 // <summary>
43 // Filter LogMessages using a TaQL expression.
44 // </summary>
45 
46 // <use visibility=export>
47 
48 // <reviewed reviewer="wbrouw" date="1996/08/21" tests="" demos="dLogging.cc" tests="tLogging.cc">
49 // </reviewed>
50 
51 // <prerequisite>
52 // <li> <linkto class="LogMessage">LogMessage</linkto>
53 // </prerequisite>
54 //
55 // <etymology>
56 // Log[Message] Filter.
57 // </etymology>
58 //
59 // <synopsis>
60 // The <src>LogFilter</src> class is used by the various log sink classes,
61 // typically accessed through <linkto class="LogSink">LogSink</linkto>, to
62 // decide whether a particular <linkto class="LogMessage">LogMessage</linkto>
63 // should be accepted or rejected.
64 //
65 // Simple filtering is based on the messages priority.
66 // In particular, you typically will choose to only pass messages greater
67 // than or equal to <src>NORMAL</src> in priority, but you might choose
68 // <src>DEBUGGING</src> to see all messages, or <src>SEVERE</src> to only see
69 // messages that report serious problems.
70 // </synopsis>
71 //
72 // <example>
73 // Suppose we wanted to change the global sink so that it prints all messages,
74 // including debugging messages:
75 // <srcblock>
76 // LogFilter all(LogMessage::DEBUGGING);
77 // LogSink::globalSink().filter(all);
78 // </srcblock>
79 // </example>
80 //
81 // <motivation>
82 // </motivation>
83 //
84 //# <todo asof="1996/07/23">
85 //# </todo>
86 
88 {
89 public:
90  // Construct a filter from a TaQL expression. Only messages matching
91  // the expression pass the filter.
92  // The field names that can be used in the expression are:
93  // TIME, PRIORITY, MESSAGE, LOCATION, OBJECT_ID.
94  // All fields are strings, expect for TIME which is a double (MJD in sec.).
95  explicit LogFilterTaql (const String& expr);
96 
97  // Copy <src>other</src> to <src>this</src>.
98  // <group>
99  LogFilterTaql (const LogFilterTaql& other);
100  LogFilterTaql& operator= (const LogFilterTaql& other);
101  // </group>
102 
103  virtual ~LogFilterTaql();
104 
105  // Clone the object.
106  virtual LogFilterTaql* clone() const;
107 
108  // Return True if <src>message</src> passes this filter.
109  virtual Bool pass (const LogMessage& message) const;
110 
111 private:
113 };
114 
115 
116 
117 } //# NAMESPACE CASACORE - END
118 
119 #endif
Abstract base class for filtering LogMessages.
virtual LogFilterTaql * clone() const
Clone the object.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
LogFilterTaql & operator=(const LogFilterTaql &other)
virtual Bool pass(const LogMessage &message) const
Return True if message passes this filter.
String: the storage and methods of handling collections of characters.
Definition: String.h:225
LogFilterExpr * expr_p
Class to deal with a TaQL expression to filter messages.
Definition: LogFilterExpr.h:54
LogFilterTaql(const String &expr)
Construct a filter from a TaQL expression.
Informational log messages with with time, priority, and origin.
Definition: LogMessage.h:101
Filter LogMessages using a TaQL expression.
Definition: LogFilterTaql.h:87