log4cpp: HierarchyMaintainer.hh Source File

- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# 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         protected:
    00046         virtual Category* _getExistingInstance(const std::string& name);
    00047         virtual Category& _getInstance(const std::string& name);
    00048         CategoryMap _categoryMap;
    00049         mutable threading::Mutex _categoryMutex;
    00050
    00051         private:
    00052         typedef std::vector<shutdown_fun_ptr> handlers_t;
    00053
    00054         static HierarchyMaintainer* _defaultMaintainer;
    00055         handlers_t handlers_;
    00056     };
    00057 }
    00058
    00059 #endif // _LOG4CPP_HIERARCHYMAINTAINER_HH