52 void Start(hipo::banklist& banks)
override;
53 bool Run(hipo::banklist& banks)
const override;
65 void Add(std::string
const& algo_class_name, std::string
const& algo_instance_name =
"");
75 template <
class ALGORITHM>
76 void Add(std::string_view algo_instance_name =
"")
78 if(algo_instance_name ==
"")
79 Add(std::make_unique<ALGORITHM>());
81 Add(std::make_unique<ALGORITHM>(algo_instance_name));
92 void Add(algo_t&& algo);
102 template <
class ALGORITHM>
103 ALGORITHM*
Get(std::string
const& algo_instance_name)
105 if(
auto it{m_algo_names.find(algo_instance_name)}; it != m_algo_names.end())
106 return dynamic_cast<ALGORITHM*
>(m_sequence[it->second].get());
107 m_log->Error(
"cannot find algorithm '{}' in sequence", algo_instance_name);
108 throw std::runtime_error(
"cannot Get algorithm");
116 template <
typename OPTION_TYPE>
117 void SetOption(std::string
const& algo_instance_name, std::string
const& key,
const OPTION_TYPE val)
130 std::vector<std::string>
GetCreatedBankNames(std::string
const& algo_instance_name)
const noexcept(
false);
168 std::vector<algo_t> m_sequence;
171 std::unordered_map<std::string, std::vector<algo_t>::size_type> m_algo_names;
#define DEFINE_IGUANA_ALGORITHM(ALGO_NAME, ALGO_FULL_NAME)
Algorithm: An algorithm that can run a sequence of algorithms
void SetConfigDirectoryForEachAlgorithm(std::string const &name)
Set a custom configuration file directory for each algorithm in the sequence.
void Add(std::string_view algo_instance_name="")
void Stop() override
Finalize this algorithm after all events are processed.
std::vector< std::string > GetCreatedBankNames(std::string const &algo_instance_name) const noexcept(false)
void Add(std::string const &algo_class_name, std::string const &algo_instance_name="")
ALGORITHM * Get(std::string const &algo_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.
std::string GetCreatedBankName(std::string const &algo_instance_name) const noexcept(false)
void SetOption(std::string const &algo_instance_name, std::string const &key, const OPTION_TYPE val)
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
bool Run(hipo::banklist &banks) const override
Run Function: Process an event's hipo::banklist
Algorithm(std::string_view name)
std::unique_ptr< Logger > m_log
Logger instance for this object