OFFIS DCMTK  Version 3.6.0
hierarchy.h
Go to the documentation of this file.
1 // Module: Log4CPLUS
2 // File: hierarchy.h
3 // Created: 6/2001
4 // Author: Tad E. Smith
5 //
6 //
7 // Copyright 2001-2009 Tad E. Smith
8 //
9 // Licensed under the Apache License, Version 2.0 (the "License");
10 // you may not use this file except in compliance with the License.
11 // You may obtain a copy of the License at
12 //
13 // http://www.apache.org/licenses/LICENSE-2.0
14 //
15 // Unless required by applicable law or agreed to in writing, software
16 // distributed under the License is distributed on an "AS IS" BASIS,
17 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 // See the License for the specific language governing permissions and
19 // limitations under the License.
20 
23 #ifndef _LOG4CPLUS_HIERARCHY_HEADER_
24 #define _LOG4CPLUS_HIERARCHY_HEADER_
25 
26 #include "dcmtk/oflog/config.h"
27 #include "dcmtk/oflog/logger.h"
31 //#include <map>
32 //#include <memory>
33 //#include <vector>
34 
35 
36 namespace log4cplus {
37  // Forward Declarations
38  class HierarchyLocker;
39 
59  class LOG4CPLUS_EXPORT Hierarchy : protected log4cplus::helpers::LogLogUser {
60  public:
61  // DISABLE_OFF should be set to a value lower than all possible
62  // priorities.
63  static const LogLevel DISABLE_OFF;
64  static const LogLevel DISABLE_OVERRIDE;
65 
66  // Ctors
70  Hierarchy();
71 
72  // Dtor
73  virtual ~Hierarchy();
74 
75  // Methods
84  virtual void clear();
85 
92  virtual bool exists(const log4cplus::tstring& name);
93 
98  virtual void disable(const log4cplus::tstring& loglevelStr);
99 
119  virtual void disable(LogLevel ll);
120 
126  virtual void disableAll();
127 
133  virtual void disableDebug();
134 
140  virtual void disableInfo();
141 
149  virtual void enableAll();
150 
161  virtual Logger getInstance(const log4cplus::tstring& name);
162 
175  virtual Logger getInstance(const log4cplus::tstring& name, spi::LoggerFactory& factory);
176 
182  virtual LoggerList getCurrentLoggers();
183 
187  virtual bool isDisabled(int level);
188 
192  virtual Logger getRoot() const;
193 
207  virtual void resetConfiguration();
208 
212  virtual void setLoggerFactory(OFauto_ptr<spi::LoggerFactory> factory);
213 
217  virtual spi::LoggerFactory* getLoggerFactory() { return defaultFactory.get(); }
218 
232  virtual void shutdown();
233 
234  private:
235  // Types
236  typedef OFList<Logger> ProvisionNode;
237  typedef OFListIterator(Logger) ProvisionNodeIterator;
238  typedef OFMap<log4cplus::tstring, ProvisionNode> ProvisionNodeMap;
239  typedef OFMap<log4cplus::tstring, Logger> LoggerMap;
240 
241  // Methods
246  virtual Logger getInstanceImpl(const log4cplus::tstring& name,
247  spi::LoggerFactory& factory);
248 
253  virtual void initializeLoggerList(LoggerList& list) const;
254 
275  void updateParents(Logger logger);
276 
291  void updateChildren(ProvisionNode& pn, Logger logger);
292 
293  // Data
294  LOG4CPLUS_MUTEX_PTR_DECLARE hashtable_mutex;
295  OFauto_ptr<spi::LoggerFactory> defaultFactory;
296  ProvisionNodeMap provisionNodes;
297  LoggerMap loggerPtrs;
298  Logger root;
299 
300  int disableValue;
301 
302  bool emittedNoAppenderWarning;
303  bool emittedNoResourceBundleWarning;
304 
305  // Disallow copying of instances of this class
306  Hierarchy(const Hierarchy&);
307  Hierarchy& operator=(const Hierarchy&);
308 
309  // Friends
310  friend class log4cplus::spi::LoggerImpl;
311  friend class log4cplus::HierarchyLocker;
312  };
313 
314 } // end namespace log4cplus
315 
316 #endif // _LOG4CPLUS_HIERARCHY_HEADER_
317 


Generated on Thu Dec 20 2012 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.2