CLAW Library (a C++ Library Absolutely Wonderful) 1.5.5
|
The design pattern of the factory allow to dynamically instanciate classes of various types given an identifier of this type. More...
#include <factory.hpp>
Classes | |
class | class_creator |
A class creator is an object that allocate a given type. More... | |
class | class_creator_base |
A class creator is an object that allocate a given type. This is the base class for all class creators. More... | |
Public Member Functions | |
~factory () | |
Destructor. | |
template<typename T > | |
bool | register_type (const identifier_type &id) |
Register a type in the factory. | |
base_class * | create (const identifier_type &id) const |
Create a new instance. | |
bool | is_known_type (const identifier_type &id) const |
Tell in a type with a given id is known by the factory. | |
Private Types | |
typedef IdentifierType | identifier_type |
The type of the data used to identify a class. | |
typedef BaseClass | base_class |
A base class for all instances created by this factory. | |
typedef std::map < identifier_type, class_creator_base * > | class_map |
The association identifier <-> type. | |
Private Attributes | |
class_map | m_classes |
The association identifier <-> type. |
The design pattern of the factory allow to dynamically instanciate classes of various types given an identifier of this type.
Template parameters:
Type requirements:
Definition at line 70 of file factory.hpp.
typedef BaseClass claw::pattern::factory< BaseClass, IdentifierType >::base_class [private] |
A base class for all instances created by this factory.
Definition at line 108 of file factory.hpp.
typedef std::map<identifier_type, class_creator_base*> claw::pattern::factory< BaseClass, IdentifierType >::class_map [private] |
The association identifier <-> type.
Definition at line 111 of file factory.hpp.
typedef IdentifierType claw::pattern::factory< BaseClass, IdentifierType >::identifier_type [private] |
The type of the data used to identify a class.
Definition at line 105 of file factory.hpp.
claw::pattern::factory< BaseClass, IdentifierType >::~factory | ( | ) |
Destructor.
Definition at line 65 of file factory.tpp.
claw::pattern::factory< BaseClass, IdentifierType >::base_class * claw::pattern::factory< BaseClass, IdentifierType >::create | ( | const identifier_type & | id | ) | const |
Create a new instance.
id | The identifier of the type to instanciate. |
Definition at line 108 of file factory.tpp.
bool claw::pattern::factory< BaseClass, IdentifierType >::is_known_type | ( | const identifier_type & | id | ) | const |
Tell in a type with a given id is known by the factory.
id | The identifier of the type to check. |
Definition at line 125 of file factory.tpp.
bool claw::pattern::factory< BaseClass, IdentifierType >::register_type | ( | const identifier_type & | id | ) |
Register a type in the factory.
id | The identifier to which the type is associated. |
Template parameters:
Definition at line 86 of file factory.tpp.
class_map claw::pattern::factory< BaseClass, IdentifierType >::m_classes [private] |
The association identifier <-> type.
Definition at line 125 of file factory.hpp.