00001 /* 00002 * HierarchyMaintainer.hh 00003 * 00004 * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 00005 * Copyright 2000, Bastiaan Bakker. All rights reserved. 00006 * 00007 * See the COPYING file for the terms of usage and distribution. 00008 */ 00009 00010 #ifndef _LOG4CPP_HIERARCHYMAINTAINER_HH 00011 #define _LOG4CPP_HIERARCHYMAINTAINER_HH 00012 00013 #include <log4cpp/Portability.hh> 00014 #include <string> 00015 #include <map> 00016 #include <vector> 00017 #include <log4cpp/Category.hh> 00018 #include <log4cpp/threading/Threading.hh> 00019 00020 namespace log4cpp { 00021 00027 class HierarchyMaintainer { 00028 friend class Log4cppCleanup; 00029 00030 public: 00031 typedef std::map<std::string, Category*> CategoryMap; 00032 00033 static HierarchyMaintainer& getDefaultMaintainer(); 00034 00035 HierarchyMaintainer(); 00036 virtual ~HierarchyMaintainer(); 00037 virtual Category* getExistingInstance(const std::string& name); 00038 virtual Category& getInstance(const std::string& name); 00039 virtual std::vector<Category*>* getCurrentCategories() const; 00040 virtual void shutdown(); 00041 virtual void deleteAllCategories(); 00042 00043 protected: 00044 virtual Category* _getExistingInstance(const std::string& name); 00045 virtual Category& _getInstance(const std::string& name); 00046 CategoryMap _categoryMap; 00047 mutable threading::Mutex _categoryMutex; 00048 00049 private: 00050 static HierarchyMaintainer* _defaultMaintainer; 00051 }; 00052 } 00053 00054 #endif // _LOG4CPP_HIERARCHYMAINTAINER_HH