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 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__ A simple class to use as exception with string message.
The design pattern of the factory allow to dynamically instanciate classes of various types given an ...
A (really) basic implementation of the singleton design pattern.
Exception thrown when an incorrect identifier is given to a type.
A (really) basic implementation of the singleton design pattern.
A simple class to use as exception with string message.
bad_type_identifier()
Constructor.
This is the main namespace.