log4tango
4.0.3
|
00001 // 00002 // Filter.hh 00003 // 00004 // Copyright (C) : 2000 - 2002 00005 // LifeLine Networks BV (www.lifeline.nl). All rights reserved. 00006 // Bastiaan Bakker. All rights reserved. 00007 // 00008 // 2004,2005,2006,2007,2008,2009,2010 00009 // Synchrotron SOLEIL 00010 // L'Orme des Merisiers 00011 // Saint-Aubin - BP 48 - France 00012 // 00013 // This file is part of log4tango. 00014 // 00015 // Log4ango is free software: you can redistribute it and/or modify 00016 // it under the terms of the GNU Lesser General Public License as published by 00017 // the Free Software Foundation, either version 3 of the License, or 00018 // (at your option) any later version. 00019 // 00020 // Log4tango is distributed in the hope that it will be useful, 00021 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 // GNU Lesser General Public License for more details. 00024 // 00025 // You should have received a copy of the GNU Lesser General Public License 00026 // along with Log4Tango. If not, see <http://www.gnu.org/licenses/>. 00027 00028 #ifndef _LOG4TANGO_FILTER_HH 00029 #define _LOG4TANGO_FILTER_HH 00030 00031 #ifdef APPENDERS_HAVE_FILTERS 00032 00033 #include <log4tango/Portability.hh> 00034 #include <log4tango/LoggingEvent.hh> 00035 00036 namespace log4tango { 00037 00069 //----------------------------------------------------------------------------- 00070 // class : Filter 00071 //----------------------------------------------------------------------------- 00072 class LOG4TANGO_EXPORT Filter 00073 { 00074 00075 public: 00076 00077 typedef enum { 00078 DENY = -1, 00079 NEUTRAL = 0, 00080 ACCEPT = 1 00081 } Decision; 00082 00086 Filter (); 00087 00091 virtual ~Filter (); 00092 00097 void set_chained_filter (Filter* filter); 00098 00104 inline Filter* Filter::get_chained_filter (void) { 00105 return _chain; 00106 } 00107 00112 virtual Filter* get_end_of_chain (void); 00113 00119 virtual void append_chained_filter (Filter* filter); 00120 00128 virtual Decision decide (const LoggingEvent& event); 00129 00130 protected: 00138 virtual Decision _decide (const LoggingEvent& event) = 0; 00139 00140 private: 00141 Filter* _chain; 00142 }; 00143 00144 } // namespace log4tango 00145 00146 #endif // APPENDERS_HAVE_FILTERS 00147 00148 #endif // _LOG4TANGO_FILTER_HH 00149 00150