#include <utilmm/types/factory.hh>
Public Member Functions | |
| bool | add (id_param id, creator_param creator) |
| Add a new production method. | |
| bool | remove (id_param id) |
| Remove a production method. | |
| bool | make_alias (id_param from, id_param to) |
| Alias creation. | |
| Result | create (id_param id) |
| Creation method. | |
| bool | check_entry (id_param id) const |
| Check for entry. | |
| ProductCreator const & | get_creator (id_param id) const |
| Creation method access. | |
Friends | |
| class | singleton::wrapper |
This class offers a generic implementation of thze factory design pattern.
A factory is a producer of classes of a special base type. The production will depend on the request.
| AbstractProduct | Base type for the produced instances. | |
| IdentifierType | Type of the production method identifiers. | |
| Result | Type of the result (AbstractProduct*). | |
| ProductCreator | Type of the creation methods (Result(*)()). | |
| FactoryErrorPolicy | Error management policy (utilmm::factory_toolbox::error) | |
| OrderId | An order between IdentifierType (std::less<IdentifierType>) |
| bool utilmm::factory< AbstractProduct, IdentifierType, Result, ProductCreator, FactoryErrorPolicy, OrderId >::add | ( | id_param | id, | |
| creator_param | creator | |||
| ) | [inline] |
Add a new production method.
This method add a new production method to the factory.
| id | Identifier for the production method | |
| creator | Production method. |
| true | if the new creation method was added | |
| false | if there was already a creation method with id |
| bool utilmm::factory< AbstractProduct, IdentifierType, Result, ProductCreator, FactoryErrorPolicy, OrderId >::remove | ( | id_param | id | ) | [inline] |
Remove a production method.
This method allow user to remove a creation method from the factory
| id | The identifier of the creation method to remove |
| true | if the creation method was removed. | |
| false | if there was no creation method attached to id |
| bool utilmm::factory< AbstractProduct, IdentifierType, Result, ProductCreator, FactoryErrorPolicy, OrderId >::make_alias | ( | id_param | from, | |
| id_param | to | |||
| ) | [inline] |
Alias creation.
Make an alias identifer for a creation method
| from | The alias identifier | |
| to | an identifer |
| true | if the alias was created | |
| false | else |
| Result utilmm::factory< AbstractProduct, IdentifierType, Result, ProductCreator, FactoryErrorPolicy, OrderId >::create | ( | id_param | id | ) | [inline] |
Creation method.
| id | an identifer |
FactoryErrorPolicy::on_unknown_id | bool utilmm::factory< AbstractProduct, IdentifierType, Result, ProductCreator, FactoryErrorPolicy, OrderId >::check_entry | ( | id_param | id | ) | const [inline] |
Check for entry.
| id | an identifer |
| true | If thered's a creation method attched to id | |
| false | else |
| ProductCreator const& utilmm::factory< AbstractProduct, IdentifierType, Result, ProductCreator, FactoryErrorPolicy, OrderId >::get_creator | ( | id_param | id | ) | const [inline] |
Creation method access.
| id | An identifier |
FactoryErrorPolicy::on_unknown_type
friend class singleton::wrapper [friend] |
1.5.3