SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
execution_handler_sequential.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
12#include <concepts>
13#include <ranges>
14
16
17namespace seqan3::detail
18{
19
31{
32public:
42 template <typename algorithm_t, typename algorithm_input_t, typename callback_t>
43 requires std::invocable<algorithm_t, algorithm_input_t, callback_t>
44 void execute(algorithm_t && algorithm, algorithm_input_t && input, callback_t && callback)
45 {
46 algorithm(std::forward<algorithm_input_t>(input), std::forward<callback_t>(callback));
47 }
48
63 template <std::copy_constructible algorithm_t,
64 std::ranges::input_range algorithm_input_range_t,
65 std::copy_constructible callback_t>
66 requires std::invocable<algorithm_t, std::ranges::range_reference_t<algorithm_input_range_t>, callback_t>
67 void bulk_execute(algorithm_t && algorithm, algorithm_input_range_t && input_range, callback_t && callback)
68 {
69 for (auto && input : input_range)
70 execute(algorithm, std::forward<decltype(input)>(input), callback);
71
72 wait();
73 }
74
76 void wait() noexcept
77 {
78 // noop
79 }
80};
81
82} // namespace seqan3::detail
T forward(T... args)
The internal SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
Provides platform and dependency checks.
Handles the sequential execution of algorithms.
Definition execution_handler_sequential.hpp:31
void wait() noexcept
Waits for the submitted jobs to finish (noop).
Definition execution_handler_sequential.hpp:76
void bulk_execute(algorithm_t &&algorithm, algorithm_input_range_t &&input_range, callback_t &&callback)
Sequentially executes the algorithm for every element of the given input range.
Definition execution_handler_sequential.hpp:67
void execute(algorithm_t &&algorithm, algorithm_input_t &&input, callback_t &&callback)
Executes the algorithm with the given input and callback.
Definition execution_handler_sequential.hpp:44
Hide me