24 TCS_EXCEPTION(
"AlgFactory: algorithm " << algName <<
" already exists. Serious configuration error.")
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.");
38 auto createdAlg = (it->second)(algName);
39 auto [itr,inserted] =
m_algs.emplace(algName, std::move(createdAlg));
41 return itr->second.get();
47 const auto& [itr, inserted] =
m_callMap.emplace(algType, creator);
50 TCS_EXCEPTION (
"TCS::AlgFactory: registration of algorithm " << algType <<
" failed since it already exists");
55std::vector<std::string>
57 std::vector<std::string> classNames;
60 classNames.push_back(key);
67 auto findRes =
m_algs.find(algName);
69 if(findRes ==
m_algs.end())
72 return findRes->second.get();
78 for(
const auto& [name, alg] :
m_algs) {
79 std::cout << name <<
" --> " << alg->fullname() << std::endl;
#define TCS_EXCEPTION(MSG)
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
bool Register(const std::string &algType, Creator creator)
Register creator function for algorithm type.
static AlgFactory &mutable_instance ATLAS_NOT_THREAD_SAFE()
non-const access
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
std::map< std::string, Creator > m_callMap
std::map< std::string, std::unique_ptr< TCS::ConfigurableAlg > > m_algs
static const AlgFactory & instance()
read-only access
ConfigurableAlg * algorithm(const std::string &algName)
Retrieve algorithm by name.
void printAlgorithmNames() const
std::vector< std::string > getAllClassNames() const