![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Base/FactoryRegistry.h>
Registry for object factories. More...
Registry for object factories.
Singleton.
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< Algorithm > | instantiateAlgorithm (const std::string &id, const ImFusion::DataList &data) const |
Create an instance of the algorithm with the given id. | |
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. | |
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::Descriptor > | compatibleDescriptors (const DataList &data) const |
Returns the descriptions of algorithms registered with all factories registered which are compatible with data. | |
std::vector< AlgorithmFactory::Descriptor > | compatibleIoDescriptors (const DataList &data) const |
Returns the descriptions of I/O algorithms registered with all factories registered which are compatible with data. | |
std::vector< AlgorithmFactory::Descriptor > | compatibleIoDescriptors (const Filesystem::Path &path) const |
Returns the descriptions of algorithms registered with this factory which can load the given file path. | |
std::vector< AlgorithmFactory::Descriptor > | algorithmDescriptors () const |
Returns the descriptions of all algorithms registered with all factories registered. | |
DataController * | createDataController (const std::string &id, const DataList &data) const |
Create data controller. | |
std::vector< std::string > | compatibleDataControllers (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. | |
AlgorithmController * | createAlgorithmController (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. | |
InteractiveObject * | createDataAnnotation (const std::string &name, Data &data) const |
Create DataAnnotation. | |
std::vector< std::string > | compatibleDataAnnotations (Data &data) const |
Return list of GL annotation names compatible with input data. | |
std::unique_ptr< Data > | cloneData (const Data &data) const |
Attempt to clone Data instance. | |
Static Public Member Functions | |
static FactoryRegistry & | get () |
Get pointer to instance. | |
Protected Attributes | |
std::vector< const AlgorithmFactory * > | m_algorithmFactories |
std::vector< const AlgorithmControllerFactory * > | m_algorithmControllerFactories |
std::vector< const DataAnnotationFactory * > | m_dataAnnotationFactories |
|
static |
Get pointer to instance.
bool registerAlgorithmFactory | ( | const AlgorithmFactory * | factory | ) |
Register algorithm factory.
If registered successfully, it takes ownership of the factory.
factory | factory |
bool unregisterAlgorithmFactory | ( | const AlgorithmFactory * | factory | ) |
Unregister algorithm factory.
If unregistered successfully, ownership of the factory is transferred to the caller.
factory | factory |
std::vector< const AlgorithmFactory * > getAlgorithmFactories | ( | ) | const |
Return all algorithm factories including default factory.
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.
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.
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.
AlgorithmFactory::Descriptor algorithmDescriptor | ( | const std::string & | id, |
bool | matchGuiName = false ) const |
Returns the descriptions of the algorithm with the given id.
matchGuiName | If 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. |
DataController * createDataController | ( | const std::string & | id, |
const DataList & | data ) const |
Create data controller.
id | data controller unique identifier |
data | input data |
bool registerAlgorithmControllerFactory | ( | const AlgorithmControllerFactory * | factory | ) |
Register algorithm controller factory.
If registered successfully, it takes ownership of the factory.
factory | factory |
bool unregisterAlgorithmControllerFactory | ( | const AlgorithmControllerFactory * | factory | ) |
Unregister algorithm controller factory.
If unregistered successfully, ownership of the factory is transferred to the caller.
factory | factory |
std::vector< const AlgorithmControllerFactory * > getAlgorithmControllerFactories | ( | ) | const |
Return all algorithm controller factories including default factory.
AlgorithmController * createAlgorithmController | ( | Algorithm * | a | ) | const |
Create algorithm.
a | associated algorithm |
bool registerDataAnnotationFactory | ( | const DataAnnotationFactory * | factory | ) |
Register data GL annotation factory.
If registered successfully, it takes ownership of the factory.
factory | factory |
bool unregisterDataAnnotationFactory | ( | const DataAnnotationFactory * | factory | ) |
Unregister data GL annotation factory.
If unregistered successfully, ownership of the factory is transferred to the caller.
factory | factory |
std::vector< const DataAnnotationFactory * > getDataAnnotationFactories | ( | ) | const |
InteractiveObject * createDataAnnotation | ( | const std::string & | name, |
Data & | data ) const |
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.