SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
seqan3::algorithm_result_generator_range< algorithm_executor_type > Class Template Reference

An input range over the algorithm results generated by the underlying algorithm executor. More...

#include <seqan3/core/algorithm/algorithm_result_generator_range.hpp>

+ Inheritance diagram for seqan3::algorithm_result_generator_range< algorithm_executor_type >:

Classes

class  algorithm_range_iterator
 The iterator of seqan3::detail::algorithm_result_generator_range. More...
 

Public Member Functions

Constructors, destructor and assignment
 algorithm_result_generator_range ()=default
 Defaulted.
 
 algorithm_result_generator_range (algorithm_result_generator_range const &)=delete
 This is a move-only type.
 
 algorithm_result_generator_range (algorithm_result_generator_range &&)=default
 Defaulted.
 
algorithm_result_generator_rangeoperator= (algorithm_result_generator_range const &)=delete
 This is a move-only type.
 
algorithm_result_generator_rangeoperator= (algorithm_result_generator_range &&)=default
 Defaulted.
 
 ~algorithm_result_generator_range ()=default
 Defaulted.
 
 algorithm_result_generator_range (algorithm_executor_type const &algorithm_executor)=delete
 Explicit deletion to forbid copy construction of the underlying executor.
 
 algorithm_result_generator_range (algorithm_executor_type &&algorithm_executor)
 Constructs a new algorithm range by taking ownership over the passed algorithm buffer.
 
Iterators
constexpr algorithm_range_iterator begin ()
 Returns an iterator to the first element of the algorithm range.
 
algorithm_range_iterator begin () const =delete
 This range is not const-iterable.
 
constexpr std::default_sentinel_t end () noexcept
 Returns a sentinel signaling the end of the algorithm range.
 
constexpr std::default_sentinel_t end () const =delete
 This range is not const-iterable.
 

Protected Member Functions

bool next ()
 Receives the next algorithm result from the executor buffer.
 

Private Types

using algorithm_result_type = typename optional_type::value_type
 The actual algorithm result type.
 
using optional_type = decltype(std::declval< algorithm_executor_type >().next_result())
 The optional type returned by the seqan3::detail::algorithm_executor_blocking.
 

Private Attributes

std::unique_ptr< algorithm_executor_type > algorithm_executor_ptr {}
 The underlying executor buffer.
 
algorithm_result_type cache {}
 Stores last read element.
 

Friends

class algorithm_range_iterator
 Befriend the iterator type.
 

Related Symbols

(Note that these are not member symbols.)

Type deduction guide
template<typename algorithm_executor_type >
 algorithm_result_generator_range (algorithm_executor_type &&) -> algorithm_result_generator_range< std::remove_reference_t< algorithm_executor_type > >
 Deduces from the passed algorithm_executor_type.
 

Detailed Description

template<typename algorithm_executor_type>
class seqan3::algorithm_result_generator_range< algorithm_executor_type >

An input range over the algorithm results generated by the underlying algorithm executor.

Template Parameters
algorithm_executor_typeThe type of the underlying algorithm executor; must be of type seqan3::detail::algorithm_executor_blocking.

Provides a lazy input-range interface over the algorithm results generated by the underlying algorithm executor. The algorithms are computed in a lazy fashion, such that when incrementing the next algorithm result is fetched from the executor. The algorithm result will be cached such that dereferencing the associated iterator is constant.

Note that the required type is not enforced in order to test this class without adding the entire machinery for the seqan3::detail::algorithm_executor_blocking.

See also
Algorithm

Constructor & Destructor Documentation

◆ algorithm_result_generator_range()

template<typename algorithm_executor_type >
seqan3::algorithm_result_generator_range< algorithm_executor_type >::algorithm_result_generator_range ( algorithm_executor_type &&  algorithm_executor)
inlineexplicit

Constructs a new algorithm range by taking ownership over the passed algorithm buffer.

Parameters
[in]algorithm_executorThe buffer to take ownership from.

Constructs a new algorithm range by taking ownership over the passed algorithm buffer.

Member Function Documentation

◆ begin()

template<typename algorithm_executor_type >
constexpr algorithm_range_iterator seqan3::algorithm_result_generator_range< algorithm_executor_type >::begin ( )
inlineconstexpr

Returns an iterator to the first element of the algorithm range.

Returns
An iterator to the first element.

Invocation of this function will trigger the computation of the first algorithm.

◆ end()

template<typename algorithm_executor_type >
constexpr std::default_sentinel_t seqan3::algorithm_result_generator_range< algorithm_executor_type >::end ( )
inlineconstexprnoexcept

Returns a sentinel signaling the end of the algorithm range.

Returns
a sentinel.

The algorithm range is an input range and the end is reached when the internal buffer over the algorithm results has signaled end-of-stream.

◆ next()

template<typename algorithm_executor_type >
bool seqan3::algorithm_result_generator_range< algorithm_executor_type >::next ( )
inlineprotected

Receives the next algorithm result from the executor buffer.

Returns
true if a new algorithm result could be fetched, otherwise false.

Fetches the next element from the underlying algorithm executor if available.


The documentation for this class was generated from the following file:
Hide me