SeqAn3 3.1.0
The Modern C++ library for sequence analysis.
execution_handler_sequential.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2021, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2021, Knut Reinert & MPI für molekulare Genetik
4// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5// shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6// -----------------------------------------------------------------------------------------------------
7
13#pragma once
14
15#include <seqan3/std/concepts>
16#include <seqan3/std/ranges>
17
19
20namespace seqan3::detail
21{
22
33struct execution_handler_sequential
34{
35public:
36
46 template <typename algorithm_t, typename algorithm_input_t, typename callback_t>
48 requires std::invocable<algorithm_t, algorithm_input_t, callback_t>
50 void execute(algorithm_t && algorithm, algorithm_input_t && input, callback_t && callback)
51 {
52 algorithm(std::forward<algorithm_input_t>(input), std::forward<callback_t>(callback));
53 }
54
69 template <std::copy_constructible algorithm_t,
70 std::ranges::input_range algorithm_input_range_t,
71 std::copy_constructible callback_t>
73 requires std::invocable<algorithm_t, std::ranges::range_reference_t<algorithm_input_range_t>, callback_t>
75 void bulk_execute(algorithm_t && algorithm, algorithm_input_range_t && input_range, callback_t && callback)
76 {
77 for (auto && input : input_range)
78 execute(algorithm, std::forward<decltype(input)>(input), callback);
79
80 wait();
81 }
82
84 void wait() noexcept
85 {
86 // noop
87 }
88};
89
90} // namespace seqan3
The <concepts> header from C++20's standard library.
T forward(T... args)
Provides platform and dependency checks.
The <ranges> header from C++20's standard library.