Belle II Software light-2406-ragdoll
CreatorFactory< T > Struct Template Reference

Very simple class to provide an easy way to register creators with the CreatorManager. More...

#include <CreatorFactory.h>

Public Member Functions

 CreatorFactory (const std::string &name)
 Constructor to register the Creator with the CreatorManager.
 

Static Public Member Functions

static CreatorBasefactory ()
 Static factory function to return a new instance of the given Creator class.
 

Detailed Description

template<class T>
struct Belle2::geometry::CreatorFactory< T >

Very simple class to provide an easy way to register creators with the CreatorManager.

When defining a new creator, add a

CreatorFactory<Classname> Classname_factory("CreatorName");

or similiar to the source file to automatically provide the needed factory function and register the creator with the CreatorManager

Definition at line 31 of file CreatorFactory.h.

Constructor & Destructor Documentation

◆ CreatorFactory()

CreatorFactory ( const std::string &  name)
inlineexplicit

Constructor to register the Creator with the CreatorManager.

Definition at line 33 of file CreatorFactory.h.

34 {
36 }
static void registerCreatorFactory(const std::string &name, CreatorFactory *factory)
Register a new creator by providing a name and a pointer to a factory for this kind of creator.
static CreatorBase * factory()
Static factory function to return a new instance of the given Creator class.

Member Function Documentation

◆ factory()

static CreatorBase * factory ( )
inlinestatic

Static factory function to return a new instance of the given Creator class.

Ownership of the object goes to the caller who is responsible of freeing the creator once it is done

Definition at line 42 of file CreatorFactory.h.

43 {
44 return new T();
45 }

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