00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00016 #ifndef LOG4CPLUS_SPI_OBJECT_REGISTRY_HEADER_
00017 #define LOG4CPLUS_SPI_OBJECT_REGISTRY_HEADER_
00018
00019 #include <log4cplus/config.h>
00020 #include <log4cplus/tstring.h>
00021 #include <log4cplus/helpers/threads.h>
00022 #include <map>
00023 #include <memory>
00024 #include <vector>
00025
00026
00027 namespace log4cplus {
00028 namespace spi {
00029
00034 class LOG4CPLUS_EXPORT ObjectRegistryBase {
00035 public:
00036
00041 bool exists(const log4cplus::tstring& name) const;
00042
00046 std::vector<log4cplus::tstring> getAllNames() const;
00047
00048 protected:
00049
00050 ObjectRegistryBase();
00051 virtual ~ObjectRegistryBase();
00052
00053
00058 bool putVal(const log4cplus::tstring& name, void* object);
00059
00064 void* getVal(const log4cplus::tstring& name) const;
00065
00069 virtual void deleteObject(void *object) const = 0;
00070
00074 virtual void clear();
00075
00076
00077 typedef std::map<log4cplus::tstring, void*> ObjectMap;
00078
00079
00080 LOG4CPLUS_MUTEX_PTR_DECLARE mutex;
00081 ObjectMap data;
00082 };
00083
00084 }
00085 }
00086
00087
00088 #endif // LOG4CPLUS_SPI_OBJECT_REGISTRY_HEADER_
00089