Class to manage all creators and provide factory access.
More...
#include <CreatorManager.h>
Class to manage all creators and provide factory access.
Definition at line 24 of file CreatorManager.h.
◆ getCreator()
CreatorBase * getCreator |
( |
const std::string & |
name, |
|
|
const std::string & |
library = "" |
|
) |
| |
|
static |
Return a new instance of a creator with the given name.
If library is not empty, the specified library will be loaded before attempting to create the creator to allow for on-demand loading of libraries.
Returns 0 if no creator with the given name is registered. Ownership of the creator is transferred to the caller who is responsible of freeing the creator.
- Parameters
-
name | Name of the Creator to be created |
library | Short name of the library which should be loaded before trying to create the creator. When library is "foo", libfoo.so will be loaded |
Definition at line 31 of file CreatorManager.cc.
33 if (!library.empty()) {
40 B2ERROR(
"Could not find a geometry creator named " << name);
static bool loadLibrary(std::string library, bool fullname=true)
Load a shared library.
Class to manage all creators and provide factory access.
std::map< std::string, CreatorFactory * > m_creatorFactories
Static map to hold all registered factories.
static CreatorManager & getInstance()
getter for the singleton instance
◆ registerCreatorFactory()
void registerCreatorFactory |
( |
const std::string & |
name, |
|
|
CreatorFactory * |
factory |
|
) |
| |
|
static |
Register a new creator by providing a name and a pointer to a factory for this kind of creator.
- Parameters
-
name | Name of the creator to be registered |
factory | Pointer to a function returning new instances of the creator |
Definition at line 26 of file CreatorManager.cc.
The documentation for this class was generated from the following files: