HierarchyMaintainer.hh
Go to the documentation of this file.
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         typedef void (*shutdown_fun_ptr)();
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         void register_shutdown_handler(shutdown_fun_ptr handler);
00043         virtual void deleteAllCategories();
00044 
00045                 typedef Category* (*creator_function_t)(const std::string& name,
00046                                                                                                                           log4cpp::Category* parent,
00047                                                                                                                           log4cpp::Priority::Value priority);
00048 
00049                 static void set_category_factory(creator_function_t creator_function);
00050 
00051         protected:
00052         virtual Category* _getExistingInstance(const std::string& name);
00053         virtual Category& _getInstance(const std::string& name);
00054         CategoryMap _categoryMap;
00055         mutable threading::Mutex _categoryMutex;
00056 
00057         private:
00058         typedef std::vector<shutdown_fun_ptr> handlers_t;
00059      
00060         static HierarchyMaintainer* _defaultMaintainer;
00061         handlers_t handlers_;
00062 
00063                 static Category* make_category(const std::string& name,
00064                                                                            log4cpp::Category* parent,
00065                                                                            log4cpp::Priority::Value priority);
00066                 static creator_function_t       _creator_function;
00067     };        
00068 }
00069 
00070 #endif // _LOG4CPP_HIERARCHYMAINTAINER_HH


log4cpp
Author(s): Stephen Roderick, Bastiaan Bakker, Cedric Le Goater, Steve Ostlind, Marcel Harkema, Walter Stroebel, Glenn Scott and Tony Cheung
autogenerated on Sat Jun 8 2019 18:45:46