17 #include <type_traits> 46 typename alignment_algorithm_t,
47 typename execution_handler_t = execution_handler_sequential>
52 class alignment_executor_two_way
62 using resource_value_type = value_type_t<resource_type>;
68 using buffer_value_type =
typename alignment_algorithm_t::result_type;
82 using value_type = buffer_value_type;
87 using difference_type =
typename buffer_type::difference_type;
94 alignment_executor_two_way() =
delete;
95 alignment_executor_two_way(alignment_executor_two_way
const &) =
delete;
96 alignment_executor_two_way(alignment_executor_two_way &&) =
default;
97 alignment_executor_two_way & operator=(alignment_executor_two_way
const &) =
delete;
98 alignment_executor_two_way & operator=(alignment_executor_two_way && ) =
default;
99 ~alignment_executor_two_way() =
default;
111 alignment_executor_two_way(resource_t resrc,
112 alignment_algorithm_t fn) :
114 kernel{std::move(fn)}
132 template <
typename exec_policy_t>
133 requires is_execution_policy_v<exec_policy_t>
134 alignment_executor_two_way(resource_t resrc,
135 alignment_algorithm_t fn,
136 exec_policy_t
const & SEQAN3_DOXYGEN_ONLY(exec)) :
137 alignment_executor_two_way{std::move(resrc), std::move(fn)}
140 "Parallel unsequenced execution not supported!");
142 "Unsequenced execution not supported!");
164 if (gptr == buffer_pointer{} || in_avail() == 0)
166 if (underflow() == eof)
168 return {std::nullopt};
171 return {std::move(*gptr++)};
175 constexpr
size_t in_avail() const noexcept
197 void setg(buffer_pointer beg, buffer_pointer
end)
218 size_t buffer_limit = in_avail();
220 count < buffer_limit && !
is_eof(); ++count, ++resource_iter, ++gptr)
222 auto && [tpl, idx] = *resource_iter;
223 auto && [first_seq, second_seq] = tpl;
224 buffer_pointer write_to = gptr;
225 exec_handler.execute(kernel,
229 [write_to] (
auto && res) { *write_to = std::move(res); });
248 void init_buffer(
size_t const size)
259 execution_handler_t exec_handler{};
262 resource_type resource{};
264 alignment_algorithm_t kernel{};
267 buffer_type buffer{};
269 buffer_pointer gptr{};
271 buffer_pointer egptr{};
279 template <
typename resource_rng_t,
typename func_t>
281 alignment_executor_two_way(resource_rng_t &&, func_t) ->
282 alignment_executor_two_way<resource_rng_t, func_t, execution_handler_sequential>;
285 template <
typename resource_rng_t,
typename func_t,
typename exec_policy_t>
286 requires is_execution_policy_v<exec_policy_t>
287 alignment_executor_two_way(resource_rng_t &&, func_t, exec_policy_t
const &) ->
288 alignment_executor_two_way<resource_rng_t,
291 execution_handler_parallel,
292 execution_handler_sequential>>;
::ranges::distance distance
Alias for ranges::distance. Returns the number of hops from first to last.
Definition: iterator:321
auto constexpr is_eof
Checks whether a given letter is equal to the EOF constant defined in <cstdio>.
Definition: predicate.hpp:95
constexpr auto zip
A range adaptor that transforms a tuple of range into a range of tuples.
Definition: ranges:948
Provides execution policies.
Provides various shortcuts for common std::ranges functions.
The concept std::CopyConstructible is satisfied if T is an lvalue reference type, or if it is a MoveC...
constexpr auto all
A view adaptor that behaves like std::view:all, but type erases contiguous ranges.
Definition: view_all.hpp:160
::ranges::size size
Alias for ranges::size. Obtains the size of a range whose size can be calculated in constant time...
Definition: ranges:189
::ranges::iterator_t iterator_t
Alias for ranges::iterator_t. Obtains the iterator type of a range.
Definition: ranges:204
Adaptations of concepts from the Ranges TS.
::ranges::begin begin
Alias for ranges::begin. Returns an iterator to the beginning of a range.
Definition: ranges:174
Provides seqan3::view::all.
Provides seqan3::detail::alignment_range.
constexpr auto iota
Generates a sequence of elements by repeatedly incrementing an initial value.
Definition: ranges:647
The concept std::Same<T, U> is satisfied if and only if T and U denote the same type.
Specifies the requirements of a Range type that is either a std::ranges::View or an lvalue-reference...
Specifies requirements of a Range type for which begin returns a type that models std::ForwardIterato...
constexpr auto single_pass_input
A view adapter that decays most of the range properties and adds single pass behavior.
Definition: single_pass_input.hpp:381
Definition: aligned_sequence_concept.hpp:35
Provides seqan3::detail::execution_handler_parallel.
Provides various transformation traits used by the range module.
::ranges::end end
Alias for ranges::end. Returns an iterator to the end of a range.
Definition: ranges:179
Provides seqan3::detail::execution_handler_sequential.