LayoutsFactory.hh 938 B

123456789101112131415161718192021222324252627282930313233343536
  1. #if !defined(h_409ac787_0acf_47ff_ac15_3e9024d40315)
  2. #define h_409ac787_0acf_47ff_ac15_3e9024d40315
  3. #include <string>
  4. #include <map>
  5. #include <memory>
  6. #include "Portability.hh"
  7. #include "Layout.hh"
  8. #include "FactoryParams.hh"
  9. LOG4CPP_NS_BEGIN
  10. class LOG4CPP_EXPORT LayoutsFactory
  11. {
  12. public:
  13. typedef FactoryParams params_t;
  14. typedef std::auto_ptr<Layout>(*create_function_t)(const params_t& params);
  15. static LayoutsFactory& getInstance();
  16. void registerCreator(const std::string& class_name, create_function_t create_function);
  17. std::auto_ptr<Layout> create(const std::string& class_name, const params_t& params);
  18. bool registed(const std::string& class_name) const;
  19. private:
  20. LayoutsFactory(){};
  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_409ac787_0acf_47ff_ac15_3e9024d40315