00001 // Module: Log4CPLUS 00002 // File: appenderattachableimpl.h 00003 // Created: 6/2001 00004 // Author: Tad E. Smith 00005 // 00006 // 00007 // Copyright 2001-2009 Tad E. Smith 00008 // 00009 // Licensed under the Apache License, Version 2.0 (the "License"); 00010 // you may not use this file except in compliance with the License. 00011 // You may obtain a copy of the License at 00012 // 00013 // http://www.apache.org/licenses/LICENSE-2.0 00014 // 00015 // Unless required by applicable law or agreed to in writing, software 00016 // distributed under the License is distributed on an "AS IS" BASIS, 00017 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00018 // See the License for the specific language governing permissions and 00019 // limitations under the License. 00020 00023 #ifndef _LOG4CPLUS_HELPERS_APPENDER_ATTACHABLE_IMPL_HEADER_ 00024 #define _LOG4CPLUS_HELPERS_APPENDER_ATTACHABLE_IMPL_HEADER_ 00025 00026 #include "dcmtk/oflog/config.h" 00027 #include "dcmtk/oflog/layout.h" 00028 #include "dcmtk/oflog/tstring.h" 00029 #include "dcmtk/oflog/helpers/lloguser.h" 00030 #include "dcmtk/oflog/helpers/pointer.h" 00031 #include "dcmtk/oflog/helpers/threads.h" 00032 #include "dcmtk/oflog/spi/apndatch.h" 00033 00034 //#include <memory> 00035 //#include <vector> 00036 00037 00038 namespace log4cplus { 00039 namespace helpers { 00040 00044 class LOG4CPLUS_EXPORT AppenderAttachableImpl 00045 : public log4cplus::spi::AppenderAttachable, 00046 protected log4cplus::helpers::LogLogUser 00047 { 00048 public: 00049 // Data 00050 LOG4CPLUS_MUTEX_PTR_DECLARE appender_list_mutex; 00051 00052 // Ctors 00053 AppenderAttachableImpl(); 00054 00055 // Dtor 00056 virtual ~AppenderAttachableImpl(); 00057 00058 // Methods 00063 virtual void addAppender(SharedAppenderPtr newAppender); 00064 00068 virtual SharedAppenderPtrList getAllAppenders(); 00069 00076 virtual SharedAppenderPtr getAppender(const log4cplus::tstring& name); 00077 00081 virtual void removeAllAppenders(); 00082 00086 virtual void removeAppender(SharedAppenderPtr appender); 00087 00092 virtual void removeAppender(const log4cplus::tstring& name); 00093 00097 int appendLoopOnAppenders(const spi::InternalLoggingEvent& event) const; 00098 00099 protected: 00100 // Types 00101 typedef OFList<SharedAppenderPtr> ListType; 00102 typedef OFListIterator(SharedAppenderPtr) ListIteratorType; 00103 typedef OFListConstIterator(SharedAppenderPtr) ListConstIteratorType; 00104 00105 // Data 00107 ListType appenderList; 00108 }; // end class AppenderAttachableImpl 00109 00110 } // end namespace helpers 00111 } // end namespace log4cplus 00112 00113 #endif // _LOG4CPLUS_HELPERS_APPENDER_ATTACHABLE_IMPL_HEADER_ 00114