diff --git a/src/engine/engine.cc b/src/engine/engine.cc index 5288690..caaae1d 100644 --- a/src/engine/engine.cc +++ b/src/engine/engine.cc @@ -91,10 +91,14 @@ Engine::Engine(std::shared_ptr listener, CrossBehaviour cross_behaviour) : listener_(listener), cross_behaviour_(cross_behaviour) {} +void Engine::process_single_order(Order const& order) { + std::visit([this](auto const& trade_order) { (*this)(trade_order); }, + order); +} + void Engine::process_orders(std::vector const& orders) { for (auto const& order : orders) { - std::visit([this](auto const& trade_order) { (*this)(trade_order); }, - order); + process_single_order(order); } } diff --git a/src/engine/engine.hh b/src/engine/engine.hh index e02fedb..9250383 100644 --- a/src/engine/engine.hh +++ b/src/engine/engine.hh @@ -25,6 +25,9 @@ struct Engine { Engine(std::shared_ptr listener, CrossBehaviour cross_behaviour = CrossBehaviour::REJECT); + /// Process a single order, triggerring the listener appropriately. + void process_single_order(Order const& order); + /// Process orders, triggerring the listener on each event. void process_orders(std::vector const& orders);