Function mimir::AlgorithmCreator¶
Defined in File AlgorithmFactory.hpp
Function Documentation¶
-
std::unique_ptr<mimir::IAlgorithm> mimir::AlgorithmCreator(const std::string &id, const YAML::Node &config, boost::statechart::fifo_scheduler<> &scheduler, boost::statechart::fifo_scheduler<>::processor_handle machine, dds::pub::Publisher publisher, dds::sub::Subscriber subscriber)¶
Function for creating an instance of the mimir::IAlgorithm.
This function uses the Factory method pattern, see e.g. [11]. When adding new algorithm, it needs to be returned by this function.
The factory function expects that input YAML
config
has a map key equal to the name identifier of the algorithm. This map is extracted and passed to the algorithm to be created.- Parameters
id – [in] Identifier string for algorithm
config – [in] User-provided YAML configuration
scheduler – [in] State machine scheduler, passed from outer context (usually main)
machine – [in] State machine handle, passed from outer context (usually main)
publisher – [in] DDS publisher for the program
subscriber – [in] DDS subscriber for the program
- Returns
mimir::IAlgorithm pointer.