#include <factory.h>
Public Member Functions | |
| Factory () | |
| Default constructor. | |
| bool | registerObject (IdentifierType id, ProductCreator creator) |
| Registers the selected object. | |
| bool | unregisterObject (const IdentifierType &id) const |
| Unregisters the selected object. | |
| AbstractProduct * | createObject (const IdentifierType &id) const |
| Creates an instance of the selected object. | |
| std::vector< IdentifierType > | registeredObjects () const |
| Returns a vector of all registered object IDs. | |
Private Types | |
| typedef std::map < IdentifierType, ProductCreator > | IdToProductMap |
| Type of container used to store object IDs. | |
Private Attributes | |
| IdToProductMap | _associations |
| Container used to store object IDs. | |
Implements "object factory" design pattern - creates instances of objects according to the given object identifier.
typedef std::map<IdentifierType, ProductCreator> Templates::Factory< AbstractProduct, IdentifierType, ProductCreator, FactoryErrorPolicy >::IdToProductMap [private] |
Type of container used to store object IDs.
| Templates::Factory< AbstractProduct, IdentifierType, ProductCreator, FactoryErrorPolicy >::Factory | ( | ) | [inline] |
Default constructor.
| bool Templates::Factory< AbstractProduct, IdentifierType, ProductCreator, FactoryErrorPolicy >::registerObject | ( | IdentifierType | id, | |
| ProductCreator | creator | |||
| ) | [inline] |
Registers the selected object.
| [in] | id | Selected object ID. |
| [in] | creator | Creator that will be used to create instances. |
| bool Templates::Factory< AbstractProduct, IdentifierType, ProductCreator, FactoryErrorPolicy >::unregisterObject | ( | const IdentifierType & | id | ) | const [inline] |
Unregisters the selected object.
| [in] | id | Selected object ID. |
| AbstractProduct* Templates::Factory< AbstractProduct, IdentifierType, ProductCreator, FactoryErrorPolicy >::createObject | ( | const IdentifierType & | id | ) | const [inline] |
Creates an instance of the selected object.
| [in] | id | Selected object ID. |
| std::vector<IdentifierType> Templates::Factory< AbstractProduct, IdentifierType, ProductCreator, FactoryErrorPolicy >::registeredObjects | ( | ) | const [inline] |
Returns a vector of all registered object IDs.
IdToProductMap Templates::Factory< AbstractProduct, IdentifierType, ProductCreator, FactoryErrorPolicy >::_associations [private] |
Container used to store object IDs.
1.5.6