30 #ifndef __CLAW_FACTORY_HPP__
31 #define __CLAW_FACTORY_HPP__
33 #ifdef CLAW_FACTORY_IS_SINGLETON
56 :
exception("No type has this identifier.")
72 template<
typename BaseClass,
typename IdentifierType>
73 #ifdef CLAW_FACTORY_IS_SINGLETON
75 public basic_singleton< factory<BaseClass, IdentifierType> >
85 class class_creator_base
88 virtual ~class_creator_base();
89 virtual BaseClass* create()
const = 0;
102 template<
typename Derived>
104 public class_creator_base
107 virtual Derived* create()
const;
112 typedef IdentifierType identifier_type;
115 typedef BaseClass base_class;
118 typedef std::map<identifier_type, class_creator_base*> class_map;
124 bool register_type(
const identifier_type&
id );
126 base_class* create(
const identifier_type&
id )
const;
128 bool is_known_type(
const identifier_type&
id )
const;
139 #include <claw/impl/factory.tpp>
141 #endif // __CLAW_FACTORY_HPP__