WireCellToolkit
Wire Cell Simulation, Signal Process and Reconstruction Toolki for Liquid Argon Detectors
WireCell::NamedFactoryRegistry< IType > Class Template Reference

#include <NamedFactory.h>

Public Types

typedef IType interface_type
 
typedef std::shared_ptr< IType > interface_ptr
 
typedef WireCell::INamedFactoryfactory_ptr
 
typedef std::unordered_map< std::string, factory_ptrfactory_lookup
 
typedef std::set< std::string > known_type_set
 

Public Member Functions

 NamedFactoryRegistry ()
 
size_t hello (const std::string &classname)
 
known_type_set known_types () const
 
bool associate (const std::string &classname, factory_ptr factory)
 Register an existing factory by the "class" name of the instance it can create. More...
 
factory_ptr lookup_factory (const std::string &classname)
 Look up an existing factory by the name of the "class" it can create. More...
 
interface_ptr instance (const std::string &classname, const std::string &instname="", bool create=true, bool nullok=false)
 
std::vector< std::string > known_classes ()
 

Detailed Description

template<class IType>
class WireCell::NamedFactoryRegistry< IType >

A registry of factories that produce instances which implement a given interface.

Definition at line 71 of file NamedFactory.h.

Member Typedef Documentation

◆ factory_lookup

template<class IType>
typedef std::unordered_map<std::string, factory_ptr> WireCell::NamedFactoryRegistry< IType >::factory_lookup

Definition at line 77 of file NamedFactory.h.

◆ factory_ptr

template<class IType>
typedef WireCell::INamedFactory* WireCell::NamedFactoryRegistry< IType >::factory_ptr

Definition at line 76 of file NamedFactory.h.

◆ interface_ptr

template<class IType>
typedef std::shared_ptr<IType> WireCell::NamedFactoryRegistry< IType >::interface_ptr

Definition at line 75 of file NamedFactory.h.

◆ interface_type

template<class IType>
typedef IType WireCell::NamedFactoryRegistry< IType >::interface_type

Definition at line 74 of file NamedFactory.h.

◆ known_type_set

template<class IType>
typedef std::set<std::string> WireCell::NamedFactoryRegistry< IType >::known_type_set

Definition at line 78 of file NamedFactory.h.

Constructor & Destructor Documentation

◆ NamedFactoryRegistry()

template<class IType>
WireCell::NamedFactoryRegistry< IType >::NamedFactoryRegistry ( )
inline

Definition at line 80 of file NamedFactory.h.

Member Function Documentation

◆ associate()

template<class IType>
bool WireCell::NamedFactoryRegistry< IType >::associate ( const std::string &  classname,
factory_ptr  factory 
)
inline

Register an existing factory by the "class" name of the instance it can create.

Definition at line 88 of file NamedFactory.h.

Here is the caller graph for this function:

◆ hello()

template<class IType>
size_t WireCell::NamedFactoryRegistry< IType >::hello ( const std::string &  classname)
inline

Definition at line 81 of file NamedFactory.h.

◆ instance()

template<class IType>
interface_ptr WireCell::NamedFactoryRegistry< IType >::instance ( const std::string &  classname,
const std::string &  instname = "",
bool  create = true,
bool  nullok = false 
)
inline

Return instance of give type and optional instance name. If create is true, create the instance if it does not exist. If nullok is true return nullptr if it does not exist else throw by default.

Definition at line 141 of file NamedFactory.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ known_classes()

template<class IType>
std::vector<std::string> WireCell::NamedFactoryRegistry< IType >::known_classes ( )
inline

Return a collection of class names known to this factory registry. Note: linked/plugged shared libraries do not automatically register their factories.

Definition at line 191 of file NamedFactory.h.

Here is the caller graph for this function:

◆ known_types()

template<class IType>
known_type_set WireCell::NamedFactoryRegistry< IType >::known_types ( ) const
inline

Definition at line 85 of file NamedFactory.h.

Here is the caller graph for this function:

◆ lookup_factory()

template<class IType>
factory_ptr WireCell::NamedFactoryRegistry< IType >::lookup_factory ( const std::string &  classname)
inline

Look up an existing factory by the name of the "class" it can create.

Definition at line 95 of file NamedFactory.h.

Here is the call graph for this function:
Here is the caller graph for this function:

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