#include <AlgFactory.h>
|
| typedef std::unique_ptr< ConfigurableAlg >(* | Creator) (const std::string &methodName) |
| | function type to create an algorithm
|
Definition at line 16 of file AlgFactory.h.
◆ Creator
| typedef std::unique_ptr< ConfigurableAlg >(* TCS::AlgFactory::Creator) (const std::string &methodName) |
function type to create an algorithm
Definition at line 19 of file AlgFactory.h.
◆ AlgFactory() [1/2]
| TCS::AlgFactory::AlgFactory |
( |
| ) |
|
|
privatedefault |
◆ AlgFactory() [2/2]
| TCS::AlgFactory::AlgFactory |
( |
const AlgFactory & | | ) |
|
|
privatedelete |
◆ algorithm()
Retrieve algorithm by name.
Definition at line 66 of file AlgFactory.cxx.
66 {
67 auto findRes =
m_algs.find(algName);
68
69 if(findRes ==
m_algs.end())
70 return nullptr;
71
72 return findRes->second.get();
73}
std::map< std::string, std::unique_ptr< TCS::ConfigurableAlg > > m_algs
◆ ATLAS_NOT_THREAD_SAFE()
| AlgFactory &mutable_instance TCS::AlgFactory::ATLAS_NOT_THREAD_SAFE |
( |
| ) |
|
|
static |
◆ create()
Create algorithm of given type and name.
Definition at line 21 of file AlgFactory.cxx.
21 {
22
24 TCS_EXCEPTION(
"AlgFactory: algorithm " << algName <<
" already exists. Serious configuration error.")
25 }
26
27
29
30
32 std::cout << "Registered algorithms are:" << std::endl;
34 std::cout <<
" " <<
x.first << std::endl;
35 TCS_EXCEPTION(
"AlgFactory: trying to instantiate algorithm of type " << algType <<
" with name " << algName <<
", but it has not been registered.");
36 }
37
38 auto createdAlg = (
it->second)(algName);
39 auto [itr,inserted] =
m_algs.emplace(algName, std::move(createdAlg));
40
41 return itr->second.get();
42}
#define TCS_EXCEPTION(MSG)
std::map< std::string, Creator > m_callMap
◆ getAllClassNames()
| std::vector< std::string > AlgFactory< ConcreteAlgorithm >::getAllClassNames |
( |
| ) |
const |
Definition at line 56 of file AlgFactory.cxx.
56 {
57 std::vector<std::string> classNames;
60 classNames.push_back(key);
61 }
62 return classNames;
63}
◆ instance()
read-only access
Definition at line 7 of file AlgFactory.cxx.
8{
9 static const TCS::AlgFactory factory;
10 return factory;
11}
◆ operator=()
◆ printAlgorithmNames()
| void AlgFactory< ConcreteAlgorithm >::printAlgorithmNames |
( |
| ) |
const |
Definition at line 77 of file AlgFactory.cxx.
77 {
78 for(
const auto& [name, alg] :
m_algs) {
79 std::cout <<
name <<
" --> " <<
alg->fullname() << std::endl;
80 }
81}
◆ Register()
| bool AlgFactory< ConcreteAlgorithm >::Register |
( |
const std::string & | algType, |
|
|
Creator | creator ) |
Register creator function for algorithm type.
Definition at line 46 of file AlgFactory.cxx.
46 {
47 const auto& [itr, inserted] =
m_callMap.emplace(algType, creator);
48
49 if (!inserted) {
50 TCS_EXCEPTION (
"TCS::AlgFactory: registration of algorithm " << algType <<
" failed since it already exists");
51 }
52 return inserted;
53}
◆ m_algs
◆ m_callMap
| std::map<std::string, Creator> TCS::AlgFactory::m_callMap |
|
private |
The documentation for this class was generated from the following files: