SeqAn3  3.2.0
The Modern C++ library for sequence analysis.
execution_handler_sequential.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2022, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2022, 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 <concepts>
16 #include <ranges>
17 
18 #include <seqan3/core/platform.hpp>
19 
20 namespace seqan3::detail
21 {
22 
33 struct execution_handler_sequential
34 {
35 public:
45  template <typename algorithm_t, typename algorithm_input_t, typename callback_t>
46  requires std::invocable<algorithm_t, algorithm_input_t, callback_t>
47  void execute(algorithm_t && algorithm, algorithm_input_t && input, callback_t && callback)
48  {
49  algorithm(std::forward<algorithm_input_t>(input), std::forward<callback_t>(callback));
50  }
51 
66  template <std::copy_constructible algorithm_t,
67  std::ranges::input_range algorithm_input_range_t,
68  std::copy_constructible callback_t>
69  requires std::invocable<algorithm_t, std::ranges::range_reference_t<algorithm_input_range_t>, callback_t>
70  void bulk_execute(algorithm_t && algorithm, algorithm_input_range_t && input_range, callback_t && callback)
71  {
72  for (auto && input : input_range)
73  execute(algorithm, std::forward<decltype(input)>(input), callback);
74 
75  wait();
76  }
77 
79  void wait() noexcept
80  {
81  // noop
82  }
83 };
84 
85 } // namespace seqan3::detail
The <concepts> header from C++20's standard library.
T forward(T... args)
requires requires
The rank_type of the semi-alphabet; defined as the return type of seqan3::to_rank....
Definition: alphabet/concept.hpp:164
Provides platform and dependency checks.
The <ranges> header from C++20's standard library.