Async 1.8.0
Async::Factory< T, Args > Class Template Referenceabstract

#include <AsyncFactory.h>

Public Member Functions

 Factory (const std::string &name)
 Constructor.
 
 Factory (const Factory< T, Args... > &)=delete
 Don't allow copy construction.
 
Factoryoperator= (const Factory< T, Args... > &)=delete
 Don't allow assignment.
 
virtual ~Factory (void)
 Destructor.
 

Static Public Member Functions

static T * createNamedObject (const std::string &name, Args... args)
 Create an instance of the named class.
 
static std::string validFactories (void)
 Get a list of valid class names.
 

Protected Member Functions

virtual T * createObject (Args... args)=0
 Create and return a new instance of an object.
 

Detailed Description

template<class T, typename... Args>
class Async::Factory< T, Args >
Examples
AsyncFactory_demo.cpp.

Definition at line 148 of file AsyncFactory.h.

Constructor & Destructor Documentation

◆ Factory() [1/2]

template<class T , typename... Args>
Async::Factory< T, Args >::Factory ( const std::string & name)
inline

Constructor.

Parameters
nameThe name of the specific object factory being created

Definition at line 191 of file AsyncFactory.h.

◆ Factory() [2/2]

template<class T , typename... Args>
Async::Factory< T, Args >::Factory ( const Factory< T, Args... > & )
delete

Don't allow copy construction.

◆ ~Factory()

template<class T , typename... Args>
virtual Async::Factory< T, Args >::~Factory ( void )
inlinevirtual

Destructor.

Definition at line 211 of file AsyncFactory.h.

Member Function Documentation

◆ createNamedObject()

template<class T , typename... Args>
static T * Async::Factory< T, Args >::createNamedObject ( const std::string & name,
Args... args )
inlinestatic

Create an instance of the named class.

Parameters
nameThe name of the class to create an instance of
argsArguments to pass to constructor, if any
Returns
Returns a newly constucted object or 0 on failure

Definition at line 157 of file AsyncFactory.h.

◆ createObject()

template<class T , typename... Args>
virtual T * Async::Factory< T, Args >::createObject ( Args... args)
protectedpure virtual

Create and return a new instance of an object.

Parameters
argsArguments to pass to constructor, if any
Returns
Returns a newly created instance of the object

Implemented in Async::SpecificFactory< Base, T, Args >, and Async::SpecificFactory< AudioContainer, T >.

◆ operator=()

template<class T , typename... Args>
Factory & Async::Factory< T, Args >::operator= ( const Factory< T, Args... > & )
delete

Don't allow assignment.

◆ validFactories()

template<class T , typename... Args>
static std::string Async::Factory< T, Args >::validFactories ( void )
inlinestatic

Get a list of valid class names.

Returns
Return a string containing a list of valid class names

This function is mostly useful for printing a message informing about which classes are available.

Definition at line 176 of file AsyncFactory.h.


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