00001 // Module: Log4CPLUS 00002 // File: hierarchylocker.h 00003 // Created: 8/2003 00004 // Author: Tad E. Smith 00005 // 00006 // 00007 // Copyright 2003-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_HIERARCHY_LOCKER_HEADER_ 00024 #define _LOG4CPLUS_HIERARCHY_LOCKER_HEADER_ 00025 00026 #include "dcmtk/oflog/hierarchy.h" 00027 00028 00029 namespace log4cplus { 00030 00034 class LOG4CPLUS_EXPORT HierarchyLocker { 00035 public: 00036 // ctor & dtor 00037 HierarchyLocker(Hierarchy& h); 00038 ~HierarchyLocker(); 00039 00043 void resetConfiguration(); 00044 00048 Logger getInstance(const log4cplus::tstring& name); 00049 00053 Logger getInstance(const log4cplus::tstring& name, spi::LoggerFactory& factory); 00054 00055 void addAppender(Logger &logger, log4cplus::SharedAppenderPtr& appender); 00056 00057 private: 00058 // Data 00059 Hierarchy& h; 00060 log4cplus::thread::Guard hierarchyLocker; 00061 LoggerList loggerList; 00062 }; 00063 00064 } // end namespace log4cplus 00065 00066 #endif // _LOG4CPLUS_HIERARCHY_LOCKER_HEADER_ 00067