MaterialX 1.39.1
Loading...
Searching...
No Matches
Factory< T > Class Template Reference

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

#include <Factory.h>

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)
 Register a new class given a unique type name and a creator function for the class.
 
bool classRegistered (const string &typeName) const
 Determine if a class has been registered for a type name.
 
void unregisterClass (const string &typeName)
 Unregister a registered class.
 
Ptr create (const string &typeName) const
 Create a new instance of the class with given type name. More...
 

Detailed Description

template<class T>
class Factory< T >

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

Member Function Documentation

◆ create()

Ptr 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.


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