oflog/include/dcmtk/oflog/hierarchy.h

Go to the documentation of this file.
00001 // Module:  Log4CPLUS
00002 // File:    hierarchy.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_HIERARCHY_HEADER_
00024 #define _LOG4CPLUS_HIERARCHY_HEADER_
00025 
00026 #include "dcmtk/oflog/config.h"
00027 #include "dcmtk/oflog/logger.h"
00028 #include "dcmtk/oflog/helpers/lloguser.h"
00029 #include "dcmtk/oflog/helpers/pointer.h"
00030 #include "dcmtk/oflog/helpers/threads.h"
00031 //#include <map>
00032 //#include <memory>
00033 //#include <vector>
00034 
00035 
00036 namespace log4cplus {
00037     // Forward Declarations
00038     class HierarchyLocker;
00039 
00059     class LOG4CPLUS_EXPORT Hierarchy : protected log4cplus::helpers::LogLogUser {
00060     public:
00061         // DISABLE_OFF should be set to a value lower than all possible
00062         // priorities.
00063         static const LogLevel DISABLE_OFF;
00064         static const LogLevel DISABLE_OVERRIDE;
00065 
00066       // Ctors
00070         Hierarchy();
00071 
00072       // Dtor
00073         virtual ~Hierarchy();
00074 
00075       // Methods
00084         virtual void clear();
00085 
00092         virtual bool exists(const log4cplus::tstring& name);
00093 
00098         virtual void disable(const log4cplus::tstring& loglevelStr);
00099 
00119         virtual void disable(LogLevel ll);
00120 
00126         virtual void disableAll();
00127 
00133         virtual void disableDebug();
00134 
00140         virtual void disableInfo();
00141 
00149         virtual void enableAll();
00150 
00161         virtual Logger getInstance(const log4cplus::tstring& name);
00162 
00175         virtual Logger getInstance(const log4cplus::tstring& name, spi::LoggerFactory& factory);
00176 
00182         virtual LoggerList getCurrentLoggers();
00183 
00187         virtual bool isDisabled(int level);
00188 
00192         virtual Logger getRoot() const;
00193 
00207         virtual void resetConfiguration();
00208 
00212         virtual void setLoggerFactory(OFauto_ptr<spi::LoggerFactory> factory);
00213 
00217         virtual spi::LoggerFactory* getLoggerFactory() { return defaultFactory.get(); }
00218 
00232         virtual void shutdown();
00233 
00234     private:
00235       // Types
00236         typedef OFList<Logger> ProvisionNode;
00237         typedef OFListIterator(Logger) ProvisionNodeIterator;
00238         typedef OFMap<log4cplus::tstring, ProvisionNode> ProvisionNodeMap;
00239         typedef OFMap<log4cplus::tstring, Logger> LoggerMap;
00240 
00241       // Methods
00246         virtual Logger getInstanceImpl(const log4cplus::tstring& name,
00247                                        spi::LoggerFactory& factory);
00248 
00253         virtual void initializeLoggerList(LoggerList& list) const;
00254 
00275         void updateParents(Logger logger);
00276 
00291         void updateChildren(ProvisionNode& pn, Logger logger);
00292 
00293     // Data
00294        LOG4CPLUS_MUTEX_PTR_DECLARE hashtable_mutex;
00295        OFauto_ptr<spi::LoggerFactory> defaultFactory;
00296        ProvisionNodeMap provisionNodes;
00297        LoggerMap loggerPtrs;
00298        Logger root;
00299 
00300        int disableValue;
00301 
00302        bool emittedNoAppenderWarning;
00303        bool emittedNoResourceBundleWarning;
00304 
00305      // Disallow copying of instances of this class
00306        Hierarchy(const Hierarchy&);
00307        Hierarchy& operator=(const Hierarchy&);
00308 
00309     // Friends
00310        friend class log4cplus::spi::LoggerImpl;
00311        friend class log4cplus::HierarchyLocker;
00312     };
00313 
00314 } // end namespace log4cplus
00315 
00316 #endif // _LOG4CPLUS_HIERARCHY_HEADER_
00317 


Generated on 6 Jan 2011 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.5.1