AppendersFactory.hh 953 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #if !defined(h_738a42b1_1502_4483_948a_a69e7bbbee6a)
  2. #define h_738a42b1_1502_4483_948a_a69e7bbbee6a
  3. #include <string>
  4. #include <map>
  5. #include <memory>
  6. #include "Portability.hh"
  7. #include "Appender.hh"
  8. #include "FactoryParams.hh"
  9. LOG4CPP_NS_BEGIN
  10. class LOG4CPP_EXPORT AppendersFactory
  11. {
  12. public:
  13. typedef FactoryParams params_t;
  14. typedef std::auto_ptr<Appender>(*create_function_t)(const params_t& params);
  15. static AppendersFactory& getInstance();
  16. void registerCreator(const std::string& class_name, create_function_t create_function);
  17. std::auto_ptr<Appender> create(const std::string& class_name, const params_t& params);
  18. bool registered(const std::string& class_name) const;
  19. private:
  20. AppendersFactory(){};
  21. typedef std::map<std::string, create_function_t> creators_t;
  22. typedef creators_t::const_iterator const_iterator;
  23. creators_t creators_;
  24. };
  25. LOG4CPP_NS_END
  26. #endif // h_738a42b1_1502_4483_948a_a69e7bbbee6a