|
ATLAS Offline Software
|
Go to the documentation of this file.
2 #ifndef L1TopoInterfaces_AlgFactory
3 #define L1TopoInterfaces_AlgFactory
14 class ConfigurableAlg;
19 typedef std::unique_ptr<ConfigurableAlg> (*
Creator)(
const std::string & methodName);
42 std::map<std::string, std::unique_ptr<TCS::ConfigurableAlg>>
m_algs;
48 #define REGISTER_ALG_NS(NS,CLASS) \
50 std::unique_ptr<TCS::ConfigurableAlg> Create##NS__##CLASS(const std::string & methodName) { \
51 auto alg = std::make_unique<NS::CLASS>(methodName); \
52 alg->setClassName( std::string(#NS) + "__" + #CLASS ); \
53 alg->msg().setName( alg->fullname() ); \
57 const bool success = TCS::AlgFactory::mutable_instance().Register( std::string(#NS) + "__" + #CLASS, Create##NS__##CLASS); \
62 #define REGISTER_ALG_TCS(CLASS) \
64 std::unique_ptr<TCS::ConfigurableAlg> Create##CLASS(const std::string & methodName) { \
65 auto alg = std::make_unique<TCS::CLASS>(methodName); \
66 alg->setClassName( #CLASS ); \
67 alg->msg().setName( alg->fullname() ); \
71 const bool success = TCS::AlgFactory::mutable_instance().Register( #CLASS, Create##CLASS); \
std::map< std::string, Creator > m_callMap
const std::string & algName(ID id)
Converts a JetAlgorithmType::ID into a string.
void printAlgorithmNames() const
std::vector< std::string > getAllClassNames() const
AlgFactory & operator=(const AlgFactory &)=delete
no assign
static const AlgFactory & instance()
read-only access
static AlgFactory &mutable_instance ATLAS_NOT_THREAD_SAFE()
non-const access
ConfigurableAlg * algorithm(const std::string &algName)
Retrieve algorithm by name.
std::map< std::string, std::unique_ptr< TCS::ConfigurableAlg > > m_algs
bool Register(const std::string &algType, Creator creator)
Register creator function for algorithm type.
AlgFactory(const AlgFactory &)=delete
no copy
ConfigurableAlg * create(const std::string &algType, const std::string &algName)
Create algorithm of given type and name.
std::unique_ptr< ConfigurableAlg >(* Creator)(const std::string &methodName)
function type to create an algorithm
Define macros for attributes used to control the static checker.