Object factory class template. More...
#include <factory.h>
Public Member Functions | |
| T * | create (const std::string &name) |
| Create object. | |
| template<class RealT > | |
| void | register_class (const std::string &name) |
| Register class. | |
| void | unregister_class (const std::string &name) |
| Unregister class. | |
| bool | is_registered (const std::string &name) |
| Check class registration state. | |
Object factory class template.
This class template is intented to provide object factory design pattern. It is used for creating objects dynamically by class name.
| T* dbp::factory< T >::create | ( | const std::string & | name | ) | [inline] |
Create object.
Creates the previously registered class instance. You should manually destroy the created object to prevent memory leaks.
| name | the class name. |
| bool dbp::factory< T >::is_registered | ( | const std::string & | name | ) | [inline] |
Check class registration state.
Returns true if the class with the given name is registered and false if not.
| void dbp::factory< T >::register_class | ( | const std::string & | name | ) | [inline] |
Register class.
Registers the class RealT with given name.
| name | the name of the class |
| void dbp::factory< T >::unregister_class | ( | const std::string & | name | ) | [inline] |
Unregister class.
Deletes class registration.
| name | the registered class name |