dbp::factory< T > Class Template Reference

Object factory class template. More...

#include <factory.h>

List of all members.

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.

Detailed Description

template<class T>
class dbp::factory< T >

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.


Member Function Documentation

template<class T >
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.

Parameters:
name the class name.
Returns:
the pointer to class instance.
template<class T >
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.

Returns:
the class registration state
template<class T >
template<class RealT >
void dbp::factory< T >::register_class ( const std::string &  name  )  [inline]

Register class.

Registers the class RealT with given name.

Parameters:
name the name of the class
template<class T >
void dbp::factory< T >::unregister_class ( const std::string &  name  )  [inline]

Unregister class.

Deletes class registration.

Parameters:
name the registered class name

The documentation for this class was generated from the following file:

 
Support This Project
SourceForge.net Logo