18 void Start(hipo::banklist& banks)
override;
19 void Run(hipo::banklist& banks)
const override;
31 void Add(std::string
const& class_name, std::string
const& instance_name =
"");
41 template <
class ALGORITHM>
42 void Add(std::string_view instance_name =
"")
44 if(instance_name ==
"")
45 Add(std::make_unique<ALGORITHM>());
47 Add(std::make_unique<ALGORITHM>(instance_name));
68 template <
class ALGORITHM>
69 ALGORITHM*
Get(std::string
const& instance_name)
71 if(
auto it{m_algo_names.find(instance_name)}; it != m_algo_names.end())
72 return dynamic_cast<ALGORITHM*
>(m_sequence[it->second].get());
73 m_log->Error(
"cannot find algorithm '{}' in sequence", instance_name);
74 throw std::runtime_error(
"cannot Get algorithm");
82 template <
typename OPTION_TYPE>
83 void SetOption(std::string
const& algo_name, std::string
const& key,
const OPTION_TYPE val)
122 std::vector<algo_t> m_sequence;
125 std::unordered_map<std::string, std::vector<algo_t>::size_type> m_algo_names;
#define DEFINE_IGUANA_ALGORITHM(ALGO_NAME, ALGO_FULL_NAME)
User-level class for running a sequence of algorithms.
void SetConfigDirectoryForEachAlgorithm(std::string const &name)
Set a custom configuration file directory for each algorithm in the sequence.
void SetOption(std::string const &algo_name, std::string const &key, const OPTION_TYPE val)
void Stop() override
Finalize this algorithm after all events are processed.
void Run(hipo::banklist &banks) const override
Run this algorithm for an event.
ALGORITHM * Get(std::string const &instance_name)
void ForEachAlgorithm(std::function< void(algo_t &)> func)
Call a function for each algorithm in the sequence.
void SetConfigFileForEachAlgorithm(std::string const &name)
Set a custom configuration file for each algorithm in the sequence.
void Add(std::string const &class_name, std::string const &instance_name="")
void Start(hipo::banklist &banks) override
Initialize this algorithm before any events are processed, with the intent to process banks
void SetName(std::string_view name)
void PrintSequence(Logger::Level level=Logger::info) const
void Add(std::string_view instance_name="")
Base class for all algorithms to inherit from.
std::unique_ptr< Logger > m_log
Logger instance for this object
General, top-level namespace for algorithms and infrastructure. For algorithms and bindings,...
std::unique_ptr< Algorithm > algo_t
Algorithm pointer type.