Belle II Software development
CreatorFactory.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <geometry/CreatorManager.h>
12
13namespace Belle2 {
18 namespace geometry {
19
20 class CreatorBase;
21
31 template<class T> struct CreatorFactory {
33 explicit CreatorFactory(const std::string& name)
34 {
36 }
43 {
44 return new T();
45 }
46 };
47
48 }
50} //end of namespace Belle2
Pure virtual base class for all geometry creators.
Definition: CreatorBase.h:28
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.
Abstract base class for different kinds of events.
Very simple class to provide an easy way to register creators with the CreatorManager.
static CreatorBase * factory()
Static factory function to return a new instance of the given Creator class.
CreatorFactory(const std::string &name)
Constructor to register the Creator with the CreatorManager.