log4tango 4.0.3
|
00001 // 00002 // AppenderAttachable.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_APPENDER_ATTACHABLE_H 00029 #define _LOG4TANGO_APPENDER_ATTACHABLE_H 00030 00031 #include <log4tango/Portability.hh> 00032 #include <map> 00033 #include <vector> 00034 #include <log4tango/Appender.hh> 00035 #include <log4tango/threading/Threading.hh> 00036 00037 namespace log4tango { 00038 00042 typedef std::map<std::string, Appender*> AppenderMap; 00043 00047 typedef AppenderMap::iterator AppenderMapIterator; 00048 00052 typedef std::vector<Appender*> AppenderList; 00053 00054 00055 //----------------------------------------------------------------------------- 00056 // class : AppenderAttachable 00057 //----------------------------------------------------------------------------- 00058 class LOG4TANGO_EXPORT AppenderAttachable 00059 { 00060 public: 00061 00065 AppenderAttachable (); 00066 00070 virtual ~AppenderAttachable (); 00071 00076 void add_appender (Appender* appender); 00077 00084 AppenderList get_all_appenders (void); 00085 00093 Appender* get_appender (const std::string& name); 00094 00099 bool is_attached (Appender* appender); 00100 00104 void remove_all_appenders(); 00105 00109 void remove_appender(Appender* appender); 00110 00115 void remove_appender(const std::string& name); 00116 00117 protected: 00118 00122 AppenderMap _appenders; 00123 00127 threading::Mutex _appendersMutex; 00128 00129 AppenderAttachable (const AppenderAttachable& other); 00130 AppenderAttachable& operator=(const AppenderAttachable& other); 00131 }; 00132 00133 } // namespace log4tango 00134 00135 #endif // _LOG4TANGO_APPENDER_ATTACHABLE_H