log4tango  5.0.1
Filter.hh
Go to the documentation of this file.
1 //
2 // Filter.hh
3 //
4 // Copyright (C) : 2000 - 2002
5 // LifeLine Networks BV (www.lifeline.nl). All rights reserved.
6 // Bastiaan Bakker. All rights reserved.
7 //
8 // 2004,2005,2006,2007,2008,2009,2010,2011,2012
9 // Synchrotron SOLEIL
10 // L'Orme des Merisiers
11 // Saint-Aubin - BP 48 - France
12 //
13 // This file is part of log4tango.
14 //
15 // Log4ango is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU Lesser General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 // Log4tango is distributed in the hope that it will be useful,
21 // but WITHOUT ANY WARRANTY; without even the implied warranty of
22 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 // GNU Lesser General Public License for more details.
24 //
25 // You should have received a copy of the GNU Lesser General Public License
26 // along with Log4Tango. If not, see <http://www.gnu.org/licenses/>.
27 
28 #ifndef _LOG4TANGO_FILTER_HH
29 #define _LOG4TANGO_FILTER_HH
30 
31 #ifdef APPENDERS_HAVE_FILTERS
32 
33 #include <log4tango/Portability.hh>
35 
36 namespace log4tango {
37 
69 //-----------------------------------------------------------------------------
70 // class : Filter
71 //-----------------------------------------------------------------------------
72 class LOG4TANGO_EXPORT Filter
73 {
74 
75 public:
76 
77  typedef enum {
78  DENY = -1,
79  NEUTRAL = 0,
80  ACCEPT = 1
81  } Decision;
82 
86  Filter ();
87 
91  virtual ~Filter ();
92 
97  void set_chained_filter (Filter* filter);
98 
104  inline Filter* Filter::get_chained_filter (void) {
105  return _chain;
106  }
107 
112  virtual Filter* get_end_of_chain (void);
113 
119  virtual void append_chained_filter (Filter* filter);
120 
128  virtual Decision decide (const LoggingEvent& event);
129 
130 protected:
138  virtual Decision _decide (const LoggingEvent& event) = 0;
139 
140 private:
141  Filter* _chain;
142 };
143 
144 } // namespace log4tango
145 
146 #endif // APPENDERS_HAVE_FILTERS
147 
148 #endif // _LOG4TANGO_FILTER_HH
149 
150 
Portability.hh
log4tango
Definition: Appender.hh:40
LOG4TANGO_EXPORT
#define LOG4TANGO_EXPORT
Definition: Export.hh:38
LoggingEvent.hh