Public Types | Public Member Functions | Protected Member Functions | List of all members
mirtk::ObjectFactory< TId, TInterface > Class Template Reference

#include <ObjectFactory.h>

Collaboration diagram for mirtk::ObjectFactory< TId, TInterface >:
Collaboration graph

Public Types

typedef Interface *(* Creator) ()
 Type of object creator.
 
typedef TId Id
 Type of object type identifier.
 
typedef ObjectFactory< Id, InterfaceInstanceType
 Type of object factory instance.
 
typedef TInterface Interface
 Type of object base class.
 

Public Member Functions

InterfaceNew (Id type_id) const
 
InterfaceNew (const char *type_name) const
 
bool Register (Id type_id, const char *type_name, Creator creator)
 

Protected Member Functions

 ObjectFactory ()
 Constructor.
 
 ObjectFactory (const ObjectFactory &)
 Copy constructor. Intentionally not implemented.
 
void operator= (const ObjectFactory &)
 Assignment operator. Intentionally not implemented.
 
virtual ~ObjectFactory ()
 Destructor.
 

Detailed Description

template<typename TId, typename TInterface>
class mirtk::ObjectFactory< TId, TInterface >

Constructs a new instance of a class derived from the template type given a type identification such as an enumeration value or string

Definition at line 41 of file ObjectFactory.h.

Member Function Documentation

§ New() [1/2]

template<typename TId , typename TInterface >
Interface* mirtk::ObjectFactory< TId, TInterface >::New ( Id  type_id) const
inline

Create new object

Parameters
[in]type_idObject type identifier.
Returns
Object of given type which must be deleted by caller or nullptr.

Definition at line 115 of file ObjectFactory.h.

§ New() [2/2]

template<typename TId , typename TInterface >
Interface* mirtk::ObjectFactory< TId, TInterface >::New ( const char *  type_name) const
inline

Create new object

Parameters
[in]type_nameObject type name.
Returns
Object of given type which must be deleted by caller or nullptr.

Definition at line 126 of file ObjectFactory.h.

§ Register()

template<typename TId , typename TInterface >
bool mirtk::ObjectFactory< TId, TInterface >::Register ( Id  type_id,
const char *  type_name,
Creator  creator 
)
inline

Register new object creator

Parameters
[in]type_idObject type identifier.
[in]type_nameObject type name.
[in]creatorObject creator function.

Definition at line 100 of file ObjectFactory.h.


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