SeqAn3  3.0.2
The Modern C++ library for sequence analysis.
execution_handler_sequential.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2020, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2020, 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 
18 #include <seqan3/core/platform.hpp>
19 
20 namespace seqan3::detail
21 {
22 
33 struct execution_handler_sequential
34 {
35 public:
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
concepts
The Concepts library.
std::forward
T forward(T... args)
ranges
Adaptations of concepts from the Ranges TS.
platform.hpp
Provides platform and dependency checks.