LayoutsFactory.hh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright 2002, LifeLine Networks BV (www.lifeline.nl). All rights reserved.
  3. * Copyright 2002, Bastiaan Bakker. All rights reserved.
  4. *
  5. * See the COPYING file for the terms of usage and distribution.
  6. */
  7. #if !defined(h_409ac787_0acf_47ff_ac15_3e9024d40315)
  8. #define h_409ac787_0acf_47ff_ac15_3e9024d40315
  9. #include <string>
  10. #include <map>
  11. #include <memory>
  12. #include "Portability.hh"
  13. #include "Layout.hh"
  14. #include "FactoryParams.hh"
  15. namespace log4cpp
  16. {
  17. class LOG4CPP_EXPORT LayoutsFactory
  18. {
  19. public:
  20. typedef FactoryParams params_t;
  21. typedef std::LOG4CPP_UNIQUE_PTR<Layout> (*create_function_t)(const params_t& params);
  22. static LayoutsFactory& getInstance();
  23. void registerCreator(const std::string& class_name, create_function_t create_function);
  24. std::LOG4CPP_UNIQUE_PTR<Layout> create(const std::string& class_name, const params_t& params);
  25. bool registed(const std::string& class_name) const;
  26. private:
  27. LayoutsFactory(){};
  28. typedef std::map<std::string, create_function_t> creators_t;
  29. typedef creators_t::const_iterator const_iterator;
  30. creators_t creators_;
  31. };
  32. }
  33. #endif // h_409ac787_0acf_47ff_ac15_3e9024d40315