62 typename alignment_selector_t,
63 typename execution_handler_t = execution_handler_sequential>
64 class alignment_executor_two_way
67 using this_t = alignment_executor_two_way<align_instance_rng_t, alignment_selector_t, execution_handler_t>;
70 template <
typename executor_t>
76 using resource_type = std::remove_reference_t<align_instance_rng_t>;
83 using resource_value_type = std::remove_reference_t<decltype(*std::declval<resource_iterator>())>;
89 using buffer_value_type =
typename std::remove_reference_t<alignment_selector_t>::result_type;
92 using buffer_type = std::vector<buffer_value_type>;
100 using reference = std::add_lvalue_reference_t<value_type>;
107 alignment_executor_two_way() =
default;
108 alignment_executor_two_way(alignment_executor_two_way
const &) =
default;
109 alignment_executor_two_way(alignment_executor_two_way &&) =
default;
110 alignment_executor_two_way & operator=(alignment_executor_two_way
const &) =
default;
111 alignment_executor_two_way & operator=(alignment_executor_two_way &&) =
default;
112 ~alignment_executor_two_way() =
default;
115 alignment_executor_two_way(align_instance_rng_t _resource,
116 alignment_selector_t _selector) :
117 resource{std::forward<align_instance_rng_t>(_resource)},
118 selector{std::forward<alignment_selector_t>(_selector)},
119 resource_iter{
begin(resource)},
120 resource_end{
end(resource)}
123 setg(
end(buffer),
end(buffer));
128 alignment_range<this_t> range()
130 return alignment_range<this_t>{*
this};
138 constexpr
size_t in_avail() const noexcept
145 std::optional<std::reference_wrapper<value_type>> bump()
147 if (gptr == buffer_pointer{} || gptr >= egptr)
149 if (underflow() ==
eof)
154 return {std::ref(*gptr++)};
158 void setg(buffer_pointer beg, buffer_pointer end)
175 std::min(static_cast<size_t>(resource_end - resource_iter), buffer.size()));
180 [
this](
auto && align_instance){
182 auto f = selector.select(std::forward<decltype(align_instance)>(align_instance));
184 exec_handler.execute(std::move(f), tmp, [&tmp](
auto && res){ tmp = std::move(res); });
188 std::advance(resource_iter, in_avail());
196 bool is_eof() const noexcept
199 return resource_iter == resource_end;
206 static constexpr
size_t eof{-1};
209 execution_handler_t exec_handler{};
212 align_instance_rng_t resource;
214 alignment_selector_t selector;
217 resource_iterator resource_iter{};
219 resource_sentinel resource_end{};
226 buffer_pointer egptr;
233 template <std::ranges::ViewableRange resource_rng_t,
typename selector_t>
234 alignment_executor_two_way(resource_rng_t && , selector_t &&) ->
235 alignment_executor_two_way<resource_rng_t, selector_t, execution_handler_sequential>;
constexpr auto transform
A range adaptor that takes a invocable and returns a view of the elements with the invocable applied...
Definition: transform.hpp:95
Contains various shortcuts for common std::ranges functions.
typename range_buffer_t::value_type value_type
The alignment result type.
Definition: alignment_range.hpp:167
::ranges::iterator_t iterator_t
Alias for ranges::iterator_t. Obtains the iterator type of a range.
Definition: ranges:225
Adaptations of concepts from the Ranges TS.
::ranges::sentinel_t sentinel_t
Alias for ranges::sentinel_t. Obtains the sentinel type of a range.
Definition: ranges:220
::ranges::begin begin
Alias for ranges::begin. Returns an iterator to the beginning of a range.
Definition: ranges:185
Provides seqan3::detail::alignment_range.
Specifies the requirements of a Range type that is either a std::ranges::View or an lvalue-reference...
constexpr bool eof() const noexcept
Returns whether the executor buffer reached is end.
Definition: alignment_range.hpp:244
auto constexpr is_eof
Checks whether a given letter is equal to the EOF constant defined in <cstdio>.
Definition: parse_condition.hpp:120
Definition: aligned_sequence_concept.hpp:288
Provides C++20 additions to the type_traits header.
typename range_buffer_t::difference_type difference_type
The offset type.
Definition: alignment_range.hpp:165
Provides various metafunctions used by the range module.
::ranges::end end
Alias for ranges::end. Returns an iterator to the end of a range.
Definition: ranges:190
The alignment.
Definition: alignment_range.hpp:60
Provides seqan3::detail::execution_handler_sequential.
typename range_buffer_t::reference reference
The reference type.
Definition: alignment_range.hpp:169