Iguana 0.0.0
Implementation Guardian of Analysis Algorithms
Loading...
Searching...
No Matches
iguana::AlgorithmFactory Class Reference

#include <Algorithm.h>

Detailed Description

Factory to create an algorithm.

Definition at line 243 of file Algorithm.h.

Public Types

using algo_creator_t = std::function<algo_t()>
 Algorithm creator function type.
 

Static Public Member Functions

static bool Register (std::string const &name, algo_creator_t creator, std::vector< std::string > const new_banks={}) noexcept
 
static algo_t Create (std::string const &name) noexcept(false)
 
static std::optional< std::vector< std::string > > QueryNewBank (std::string const &bank_name) noexcept
 

Member Typedef Documentation

◆ algo_creator_t

Algorithm creator function type.

Definition at line 249 of file Algorithm.h.

Member Function Documentation

◆ Create()

static algo_t iguana::AlgorithmFactory::Create ( std::string const & name)
static

Create an algorithm. Throws an exception if the algorithm cannot be created

Parameters
namethe name of the algorithm, which was used as an argument in the AlgorithmFactory::Register call
Returns
the algorithm instance

◆ QueryNewBank()

static std::optional< std::vector< std::string > > iguana::AlgorithmFactory::QueryNewBank ( std::string const & bank_name)
staticnoexcept

Check if a bank is created by an algorithm

Parameters
bank_namethe name of the bank
Returns
the list of algorithms which create it, if any

◆ Register()

static bool iguana::AlgorithmFactory::Register ( std::string const & name,
algo_creator_t creator,
std::vector< std::string > const new_banks = {} )
staticnoexcept

Register an algorithm with a unique name. Algorithms register themselves by calling this function.

Parameters
namethe name of the algorithm (not equivalent to Object::m_name)
creatorthe creator function
new_banksif this algorithm creates new banks, list them here
Returns
true if the algorithm has not yet been registered

The documentation for this class was generated from the following file: