HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Factory< T > Class Template Reference

#include <Factory.h>

+ Inheritance diagram for Factory< T >:

Public Types

using Ptr = shared_ptr< T >
 
using CreatorFunction ) = Ptr(*)(
 
using CreatorMap = std::unordered_map< string, CreatorFunction >
 

Public Member Functions

void registerClass (const string &typeName, CreatorFunction f)
 
bool classRegistered (const string &typeName) const
 Determine if a class has been registered for a type name. More...
 
void unregisterClass (const string &typeName)
 Unregister a registered class. More...
 
Ptr create (const string &typeName) const
 
- Public Member Functions inherited from TIL_RasterFilter::Factory
 Factory ()=default
 
virtual ~Factory ()
 
virtual const UT_StringHoldername () const =0
 
virtual const UT_StringHolderlabel () const =0
 
virtual TIL_RasterFilterPtr newFilter () const =0
 

Detailed Description

template<class T>
class Factory< T >

Factory class for creating instances of classes given their type name.

Examples:
IMG/TIL_NullFilter.C.

Definition at line 18 of file Factory.h.

Member Typedef Documentation

template<class T>
using Factory< T >::CreatorFunction = Ptr (*)(

Definition at line 22 of file Factory.h.

template<class T>
using Factory< T >::CreatorMap = std::unordered_map<string, CreatorFunction>

Definition at line 23 of file Factory.h.

template<class T>
using Factory< T >::Ptr = shared_ptr<T>

Definition at line 21 of file Factory.h.

Member Function Documentation

template<class T>
bool Factory< T >::classRegistered ( const string typeName) const
inline

Determine if a class has been registered for a type name.

Definition at line 33 of file Factory.h.

template<class T>
Ptr Factory< T >::create ( const string typeName) const
inline

Create a new instance of the class with given type name. Returns nullptr if no class with given name is registered.

Definition at line 50 of file Factory.h.

template<class T>
void Factory< T >::registerClass ( const string typeName,
CreatorFunction  f 
)
inline

Register a new class given a unique type name and a creator function for the class.

Definition at line 27 of file Factory.h.

template<class T>
void Factory< T >::unregisterClass ( const string typeName)
inline

Unregister a registered class.

Definition at line 39 of file Factory.h.


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