00001 #if !defined(h_409ac787_0acf_47ff_ac15_3e9024d40315) 00002 #define h_409ac787_0acf_47ff_ac15_3e9024d40315 00003 00004 #include <string> 00005 #include <map> 00006 #include <memory> 00007 #include "Portability.hh" 00008 #include "Layout.hh" 00009 #include "FactoryParams.hh" 00010 00011 LOG4CPP_NS_BEGIN 00012 class LOG4CPP_EXPORT LayoutsFactory 00013 { 00014 public: 00015 typedef FactoryParams params_t; 00016 typedef std::auto_ptr<Layout>(*create_function_t)(const params_t& params); 00017 00018 static LayoutsFactory& getInstance(); 00019 void registerCreator(const std::string& class_name, create_function_t create_function); 00020 std::auto_ptr<Layout> create(const std::string& class_name, const params_t& params); 00021 bool registed(const std::string& class_name) const; 00022 00023 private: 00024 LayoutsFactory(){}; 00025 00026 typedef std::map<std::string, create_function_t> creators_t; 00027 typedef creators_t::const_iterator const_iterator; 00028 00029 creators_t creators_; 00030 }; 00031 LOG4CPP_NS_END 00032 00033 00034 00035 #endif // h_409ac787_0acf_47ff_ac15_3e9024d40315