LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
Lima::MainFactory< Factory > Class Template Reference

#include <common/AbstractFactoryPattern/MainFactory.h>

Public Member Functions

const std::shared_ptr< Factory > getFactory (const std::string &classId) const
 create an Object using the appropriate registered factory.
 
std::shared_ptr< Factory > getFactory (const std::string &classId)
 create an Object using the appropriate registered factory.
 
void registerFactory (const std::string &classId, Factory *fact)
 register a factory with an id
 
std::deque< std::string > getRegisteredFactories () const
 show registered classId
 
virtual ~MainFactory ()
 

Static Public Member Functions

static const MainFactory< Factory > & single ()
 const singleton accessor
 
static MainFactory< Factory > & changeable ()
 singleton accessor
 
static void cleanup ()
 destroy factory and all registered factories
 

Detailed Description

template<typename Factory>
class Lima::MainFactory< Factory >

Definition at line 36 of file MainFactory.h.

Constructor & Destructor Documentation

◆ ~MainFactory()

template<typename Factory >
Lima::MainFactory< Factory >::~MainFactory ( )
virtual

Definition at line 148 of file MainFactory.h.

Member Function Documentation

◆ changeable()

template<typename Factory >
MainFactory< Factory > & Lima::MainFactory< Factory >::changeable ( )
static

singleton accessor

Definition at line 128 of file MainFactory.h.

◆ cleanup()

template<typename Factory >
void Lima::MainFactory< Factory >::cleanup ( )
static

destroy factory and all registered factories

Definition at line 143 of file MainFactory.h.

◆ getFactory() [1/2]

template<typename Factory >
std::shared_ptr< Factory > Lima::MainFactory< Factory >::getFactory ( const std::string &  classId)

create an Object using the appropriate registered factory.

Parameters
unitConfigurationIN : object configuration parameters
Returns
Object* pointer to the created Object
Exceptions
InvalidConfigurationif 'class' parameter does not exist or \ if no appropriate factory is available
UndefinedMethodif corresponding create method is not defined

Use the 'class' parameter of unitConfiguration to select the factory to which delegate the creation of the object.

Definition at line 176 of file MainFactory.h.

◆ getFactory() [2/2]

template<typename Factory >
const std::shared_ptr< Factory > Lima::MainFactory< Factory >::getFactory ( const std::string &  classId) const

create an Object using the appropriate registered factory.

Parameters
unitConfigurationIN : object configuration parameters
Returns
Object* pointer to the created Object
Exceptions
InvalidConfigurationif 'class' parameter does not exist or \ if no appropriate factory is available
UndefinedMethodif corresponding create method is not defined

Use the 'class' parameter of unitConfiguration to select the factory to which delegate the creation of the object.

Definition at line 153 of file MainFactory.h.

◆ getRegisteredFactories()

template<typename Factory >
std::deque< std::string > Lima::MainFactory< Factory >::getRegisteredFactories ( ) const

show registered classId

Returns
list of registered classId

Definition at line 216 of file MainFactory.h.

◆ registerFactory()

template<typename Factory >
void Lima::MainFactory< Factory >::registerFactory ( const std::string &  classId,
Factory *  fact 
)

register a factory with an id

Parameters
classIdIN : classId for the factory
factIN : factory to register
Exceptions
InvalidConfigurationif already a factory for this classId

Definition at line 199 of file MainFactory.h.

◆ single()

template<typename Factory >
const MainFactory< Factory > & Lima::MainFactory< Factory >::single ( )
static

const singleton accessor

Definition at line 114 of file MainFactory.h.


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