From fe323f19cb9de8f02b7f8482cf9d1e6d437ed535 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Sat, 23 May 2020 10:39:05 +0300 Subject: [PATCH] genesys: Add a way to push constructed nodes to pipeline --- backend/genesys/image_pipeline.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/backend/genesys/image_pipeline.h b/backend/genesys/image_pipeline.h index f85c17574..4a1bdc7af 100644 --- a/backend/genesys/image_pipeline.h +++ b/backend/genesys/image_pipeline.h @@ -585,19 +585,31 @@ public: template void push_first_node(Args&&... args) + { + push_first_node(std::unique_ptr(new Node(std::forward(args)...))); + } + + template + void push_first_node(std::unique_ptr&& node) { if (!nodes_.empty()) { throw SaneException("Trying to append first node when there are existing nodes"); } - nodes_.emplace_back(std::unique_ptr(new Node(std::forward(args)...))); + nodes_.emplace_back(std::move(node)); } template void push_node(Args&&... args) { ensure_node_exists(); - nodes_.emplace_back(std::unique_ptr(new Node(*nodes_.back(), - std::forward(args)...))); + push_node(std::unique_ptr(new Node(*nodes_.back(), std::forward(args)...))); + } + + template + void push_node(std::unique_ptr&& node) + { + ensure_node_exists(); + nodes_.emplace_back(std::move(node)); } bool get_next_row_data(std::uint8_t* out_data)