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/Log4cppCleanup.hh> 00019 #include <log4cpp/threading/Threading.hh> 00020 00021 namespace log4cpp { 00022 00028 class HierarchyMaintainer { 00029 friend class Log4cppCleanup; 00030 00031 public: 00032 typedef std::map<std::string, Category*> CategoryMap; 00033 00034 static HierarchyMaintainer& getDefaultMaintainer(); 00035 00036 HierarchyMaintainer(); 00037 virtual ~HierarchyMaintainer(); 00038 virtual Category* getExistingInstance(const std::string& name); 00039 virtual Category& getInstance(const std::string& name); 00040 virtual std::vector<Category*>* getCurrentCategories() const; 00041 virtual void shutdown(); 00042 virtual void deleteAllCategories(); 00043 00044 protected: 00045 virtual Category* _getExistingInstance(const std::string& name); 00046 virtual Category& _getInstance(const std::string& name); 00047 CategoryMap _categoryMap; 00048 mutable threading::Mutex _categoryMutex; 00049 00050 private: 00051 static HierarchyMaintainer* _defaultMaintainer; 00052 00053 #ifdef LOG4CPP_USE_CLEANUP 00054 static Log4cppCleanup& _fuckinDummy; 00055 #endif 00056 }; 00057 } 00058 00059 #endif // _LOG4CPP_HIERARCHYMAINTAINER_HH