ImFusion SDK 4.3
FactoryRegistry Class Reference

#include <ImFusion/Base/FactoryRegistry.h>

Registry for object factories. More...

+ Inheritance diagram for FactoryRegistry:

Detailed Description

Registry for object factories.

Singleton.

See also
ImFusionPlugin

Public Member Functions

bool registerAlgorithmFactory (const AlgorithmFactory *factory)
 Register algorithm factory.
 
bool unregisterAlgorithmFactory (const AlgorithmFactory *factory)
 Unregister algorithm factory.
 
std::vector< const AlgorithmFactory * > getAlgorithmFactories () const
 Return all algorithm factories including default factory.
 
template<typename T>
std::unique_ptr< T > instantiateAlgorithm (const ImFusion::DataList &data) const
 Create an instance of the algorithm with the given type T.
 
std::unique_ptr< AlgorithminstantiateAlgorithm (const std::string &id, const ImFusion::DataList &data) const
 Create an instance of the algorithm with the given id.
 
std::unique_ptr< IoAlgorithminstantiateIoAlgorithm (const std::string &id, const ImFusion::DataList &data) const
 Convenience function to create an instance of an IO algorithm with the given id.
 
template<typename T>
AlgorithmFactory::Descriptor algorithmDescriptor () const
 Returns the descriptions of the algorithm type T. If multiple algorithms of type T are registered, the first one is returned.
 
AlgorithmFactory::Descriptor algorithmDescriptor (const std::string &id, bool matchGuiName=false) const
 Returns the descriptions of the algorithm with the given id.
 
std::vector< AlgorithmFactory::DescriptorcompatibleDescriptors (const DataList &data) const
 Returns the descriptions of algorithms registered with all factories registered which are compatible with data.
 
std::vector< AlgorithmFactory::DescriptorcompatibleIoDescriptors (const DataList &data) const
 Returns the descriptions of I/O algorithms registered with all factories registered which are compatible with data.
 
std::vector< AlgorithmFactory::DescriptorcompatibleIoDescriptors (const Filesystem::Path &path) const
 Returns the descriptions of algorithms registered with this factory which can load the given file path.
 
std::vector< AlgorithmFactory::DescriptoralgorithmDescriptors () const
 Returns the descriptions of all algorithms registered with all factories registered.
 
DataControllercreateDataController (const std::string &id, const DataList &data) const
 Create data controller.
 
std::vector< std::stringcompatibleDataControllers (const DataList &data) const
 Return list of data controllers compatible with input data (unique identifier and name)
 
bool registerAlgorithmControllerFactory (const AlgorithmControllerFactory *factory)
 Register algorithm controller factory.
 
bool unregisterAlgorithmControllerFactory (const AlgorithmControllerFactory *factory)
 Unregister algorithm controller factory.
 
std::vector< const AlgorithmControllerFactory * > getAlgorithmControllerFactories () const
 Return all algorithm controller factories including default factory.
 
AlgorithmControllercreateAlgorithmController (Algorithm *a) const
 Create algorithm.
 
bool registerDataAnnotationFactory (const DataAnnotationFactory *factory)
 Register data GL annotation factory.
 
bool unregisterDataAnnotationFactory (const DataAnnotationFactory *factory)
 Unregister data GL annotation factory.
 
std::vector< const DataAnnotationFactory * > getDataAnnotationFactories () const
 Return all data GL annotation factories.
 
InteractiveObjectcreateDataAnnotation (const std::string &name, Data &data) const
 Create DataAnnotation.
 
std::vector< std::stringcompatibleDataAnnotations (Data &data) const
 Return list of GL annotation names compatible with input data.
 
std::unique_ptr< DatacloneData (const Data &data) const
 Attempt to clone Data instance.
 

Static Public Member Functions

static FactoryRegistryget ()
 Get pointer to instance.
 

Protected Attributes

std::vector< const AlgorithmFactory * > m_algorithmFactories
 
std::vector< const AlgorithmControllerFactory * > m_algorithmControllerFactories
 
std::vector< const DataAnnotationFactory * > m_dataAnnotationFactories
 

Member Function Documentation

◆ get()

static FactoryRegistry & get ( )
static

Get pointer to instance.

Returns
instance

◆ registerAlgorithmFactory()

bool registerAlgorithmFactory ( const AlgorithmFactory * factory)

Register algorithm factory.

If registered successfully, it takes ownership of the factory.

Parameters
factoryfactory
Returns
true if successful

◆ unregisterAlgorithmFactory()

bool unregisterAlgorithmFactory ( const AlgorithmFactory * factory)

Unregister algorithm factory.

If unregistered successfully, ownership of the factory is transferred to the caller.

Parameters
factoryfactory
Returns
true if successful

◆ getAlgorithmFactories()

std::vector< const AlgorithmFactory * > getAlgorithmFactories ( ) const

Return all algorithm factories including default factory.

Returns
algorithm factories

◆ instantiateAlgorithm() [1/2]

template<typename T>
std::unique_ptr< T > instantiateAlgorithm ( const ImFusion::DataList & data) const

Create an instance of the algorithm with the given type T.

Will return nullptr if no such algorithm is registered, or if the algorithm creation fails.

◆ instantiateAlgorithm() [2/2]

std::unique_ptr< Algorithm > instantiateAlgorithm ( const std::string & id,
const ImFusion::DataList & data ) const

Create an instance of the algorithm with the given id.

Will return nullptr if no such algorithm is registered, or if the algorithm creation fails.

◆ instantiateIoAlgorithm()

std::unique_ptr< IoAlgorithm > instantiateIoAlgorithm ( const std::string & id,
const ImFusion::DataList & data ) const

Convenience function to create an instance of an IO algorithm with the given id.

Will return nullptr if no such algorithm is registered, or if the algorithm is not an IoAlgorithm, or the algorithm creation fails.

◆ algorithmDescriptor()

AlgorithmFactory::Descriptor algorithmDescriptor ( const std::string & id,
bool matchGuiName = false ) const

Returns the descriptions of the algorithm with the given id.

Parameters
matchGuiNameIf true, tries to find algorithms with matching GUI names if no algorithm with the given id is found. Returns a default constructed Descriptor if no matching algorithm is found.

◆ createDataController()

DataController * createDataController ( const std::string & id,
const DataList & data ) const

Create data controller.

Parameters
iddata controller unique identifier
datainput data
Returns
pointer to generated data controller if successful, zero otherwise

◆ registerAlgorithmControllerFactory()

bool registerAlgorithmControllerFactory ( const AlgorithmControllerFactory * factory)

Register algorithm controller factory.

If registered successfully, it takes ownership of the factory.

Parameters
factoryfactory
Returns
true if successful

◆ unregisterAlgorithmControllerFactory()

bool unregisterAlgorithmControllerFactory ( const AlgorithmControllerFactory * factory)

Unregister algorithm controller factory.

If unregistered successfully, ownership of the factory is transferred to the caller.

Parameters
factoryfactory
Returns
true if successful

◆ getAlgorithmControllerFactories()

std::vector< const AlgorithmControllerFactory * > getAlgorithmControllerFactories ( ) const

Return all algorithm controller factories including default factory.

Returns
algorithm factories

◆ createAlgorithmController()

AlgorithmController * createAlgorithmController ( Algorithm * a) const

Create algorithm.

Parameters
aassociated algorithm
Returns
pointer to generated algorithm controller if successful, zero otherwise

◆ registerDataAnnotationFactory()

bool registerDataAnnotationFactory ( const DataAnnotationFactory * factory)

Register data GL annotation factory.

If registered successfully, it takes ownership of the factory.

Parameters
factoryfactory
Returns
true if successful

◆ unregisterDataAnnotationFactory()

bool unregisterDataAnnotationFactory ( const DataAnnotationFactory * factory)

Unregister data GL annotation factory.

If unregistered successfully, ownership of the factory is transferred to the caller.

Parameters
factoryfactory
Returns
true if successful

◆ getDataAnnotationFactories()

std::vector< const DataAnnotationFactory * > getDataAnnotationFactories ( ) const

Return all data GL annotation factories.

Returns
data GL annotation factories

◆ createDataAnnotation()

InteractiveObject * createDataAnnotation ( const std::string & name,
Data & data ) const

Create DataAnnotation.

Parameters
iddata GL annotation unique identifier
datainput data
Returns
pointer to generated GL annotation if successful, zero otherwise

◆ cloneData()

std::unique_ptr< Data > cloneData ( const Data & data) const

Attempt to clone Data instance.

If successful, return a unique_ptr to the clone. Otherwise, return nullptr.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close