SeqAn3 3.1.0
The Modern C++ library for sequence analysis.
seqan3::gap_decorator< inner_type >::gap_decorator_iterator Class Reference

The iterator type over a seqan3::gap_decorator. More...

#include <seqan3/alignment/decorator/gap_decorator.hpp>

+ Inheritance diagram for seqan3::gap_decorator< inner_type >::gap_decorator_iterator:

Public Types

Associated types
using difference_type = typename gap_decorator::difference_type
 The difference type.
 
using value_type = typename gap_decorator::value_type
 The value type.
 
using reference = typename gap_decorator::const_reference
 The reference type.
 
using pointer = value_type *
 The pointer type.
 
using iterator_category = std::bidirectional_iterator_tag
 The iterator category.
 

Public Member Functions

Constructors, destructor and assignment
 gap_decorator_iterator ()=default
 Defaulted.
 
 gap_decorator_iterator (gap_decorator_iterator const &)=default
 Defaulted.
 
gap_decorator_iteratoroperator= (gap_decorator_iterator const &)=default
 Defaulted.
 
 gap_decorator_iterator (gap_decorator_iterator &&)=default
 Defaulted.
 
gap_decorator_iteratoroperator= (gap_decorator_iterator &&)=default
 Defaulted.
 
 ~gap_decorator_iterator ()=default
 Defaulted.
 
 gap_decorator_iterator (gap_decorator const &host_)
 Construct from seqan3::gap_decorator and initialising to first position.
 
 gap_decorator_iterator (gap_decorator const &host_, typename gap_decorator::size_type const pos_)
 Construct from seqan3::gap_decorator and explicit position.
 
Element access
reference operator* () const
 Dereference operator returns a copy of the element currently pointed at.
 
reference operator[] (difference_type const n) const
 Return underlying container value currently pointed at.
 

Protected Member Functions

void jump (typename gap_decorator::size_type const new_pos)
 A helper function that performs the random access into the anchor set, updating all member variables.
 

Protected Attributes

gap_decorator::set_iterator_type anchor_set_it {}
 A pointer to the current anchor gap node. Note that the current tuple value at position 0 is the start of the right gap that is still behind the current iterator position.
 
std::add_pointer_t< gap_decorator const > host {nullptr}
 Pointer to the underlying container structure.
 
bool is_at_gap {true}
 Caches whether the iterator points to a gap (true) or not (false).
 
gap_decorator::size_type left_gap_end {0}
 Stores the position (incl. gaps) where the last (consecutive) gap that is still before the current iterator position ends.
 
gap_decorator::size_type pos {0u}
 Stores the virtual position index for the seqan3::gap_decorator.
 
int64_t ungapped_view_pos {0}
 Stores the physical position in the ungapped/underlying view.
 

Friends

Comparison operators

Compares iterators by virtual position.

bool operator== (gap_decorator_iterator const &lhs, gap_decorator_iterator const &rhs) noexcept
 Checks whether *this is equal to rhs.
 
bool operator!= (gap_decorator_iterator const &lhs, gap_decorator_iterator const &rhs) noexcept
 Checks whether *this is not equal to rhs.
 
bool operator< (gap_decorator_iterator const &lhs, gap_decorator_iterator const &rhs) noexcept
 Checks whether *this is less than rhs.
 
bool operator> (gap_decorator_iterator const &lhs, gap_decorator_iterator const &rhs) noexcept
 Checks whether *this is greater than rhs.
 
bool operator<= (gap_decorator_iterator const &lhs, gap_decorator_iterator const &rhs) noexcept
 Checks whether *this is less than or equal to rhs.
 
bool operator>= (gap_decorator_iterator const &lhs, gap_decorator_iterator const &rhs) noexcept
 Checks whether *this is greater than or equal to rhs.
 

Arithmetic operators

gap_decorator_iteratoroperator++ ()
 Increments iterator.
 
gap_decorator_iterator operator++ (int)
 Returns an incremented iterator copy.
 
gap_decorator_iteratoroperator+= (difference_type const skip)
 Advances iterator by skip many positions.
 
gap_decorator_iterator operator+ (difference_type const skip) const
 Returns an iterator copy advanced by skip many positions.
 
gap_decorator_iteratoroperator-- ()
 Decrements iterator.
 
gap_decorator_iterator operator-- (int)
 Returns a decremented iterator copy.
 
gap_decorator_iteratoroperator-= (difference_type const skip)
 Advances iterator by skip many positions.
 
gap_decorator_iterator operator- (difference_type const skip) const
 Returns an iterator copy advanced by skip many positions.
 
difference_type operator- (gap_decorator_iterator const lhs) const noexcept
 Returns the distance between two iterators.
 
gap_decorator_iterator operator+ (difference_type const skip, gap_decorator_iterator const &it)
 Returns an iterator copy advanced by skip many positions.
 
gap_decorator_iterator operator- (difference_type const skip, gap_decorator_iterator const &it)
 Returns an iterator copy advanced by skip many positions.
 

Detailed Description

template<std::ranges::viewable_range inner_type>
class seqan3::gap_decorator< inner_type >::gap_decorator_iterator

The iterator type over a seqan3::gap_decorator.

This iterator returns values when dereferenced, not references, i.e. it does not satisfy the semantic requirements of Cpp17BidirectionalIterator. It does model the C++20 std::bidirectional_iterator. In addition, it offers all interfaces of a standard std::random_access_iterator except the iterator category which is defined as std::bidirectional_iterator_tag, because the complexity of the iterator is logarithmic and not constant. However, all interfaces inside the seqan3::gap_decorator make use of the more efficient logarithmic implementation. Be aware, that if you want to use the seqan3::gap_decorator in a generic algorithm, e.g. std::ranges::distance, the slower linear version will be picked due to the constraints of the iterator category. To achieve optimal performance in a generic context you can use seqan3::views::enforce_random_access to get a range over seqan3::gap_decorator which models std::random_access_iterator albeit its non-conforming runtime complexity.


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