SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
seqan3::detail::two_dimensional_matrix< value_t, allocator_t, order >::basic_iterator< const_range > Class Template Reference

A two-dimensional matrix iterator. More...

#include <seqan3/alignment/matrix/detail/two_dimensional_matrix.hpp>

+ Inheritance diagram for seqan3::detail::two_dimensional_matrix< value_t, allocator_t, order >::basic_iterator< const_range >:

Public Types

Associated types
using value_type = std::iter_value_t< storage_iterator >
 Value type of this iterator.
 
using reference = std::iter_reference_t< storage_iterator >
 Reference to value_type.
 
using pointer = typename storage_iterator::pointer
 The pointer type.
 
using difference_type = std::iter_difference_t< storage_iterator >
 Type for distances between iterators.
 
using iterator_category = std::random_access_iterator_tag
 The iterator tag.
 

Public Member Functions

matrix_coordinate coordinate () const noexcept
 Returns the current position of the iterator as a two-dimensional matrix coordinate.
 
constexpr derived_toperator+= (matrix_offset const &offset) noexcept
 Advances the iterator by the given offset in the respective matrix dimensions.
 
constexpr basic_iteratoroperator+= (matrix_offset const &offset) noexcept
 Advances the iterator by the given offset.
 
template<typename dummy_t = derived_t>
constexpr derived_toperator+= (std::iter_difference_t< dummy_t > const offset) noexcept
 Advances the iterator by offset following the given matrix major order.
 
Constructors, destructor and assignment
constexpr basic_iterator ()=default
 Defaulted.
 
constexpr basic_iterator (basic_iterator const &)=default
 Defaulted.
 
constexpr basic_iterator (basic_iterator &&)=default
 Defaulted.
 
constexpr basic_iteratoroperator= (basic_iterator const &)=default
 Defaulted.
 
constexpr basic_iteratoroperator= (basic_iterator &&)=default
 Defaulted.
 
 ~basic_iterator ()=default
 Defaulted.
 
constexpr basic_iterator (parent_t &matrix, storage_iterator iter)
 Construction from the underlying matrix and the iterator over actual storage.
 
constexpr basic_iterator (basic_iterator<!const_range > const &other) noexcept
 Construction of cons-iterator from non-const-iterator.
 
- Public Member Functions inherited from seqan3::detail::two_dimensional_matrix_iterator_base< basic_iterator< const_range >, order >
constexpr reference< dummy_t > operator* () const noexcept
 Returns a reference to the pointed to element.
 
constexpr reference< dummy_t > operator[] (std::iter_difference_t< dummy_t > const offset) const noexcept
 Returns a reference to the pointed-to-element after advancing the iterator by the given offset.
 
constexpr reference< dummy_t > operator[] (matrix_offset const &offset) const noexcept
 Returns a reference to the pointed-to-element after advancing the iterator by the given offset.
 
constexpr pointer< dummy_t > operator-> () const noexcept
 Returns a pointer to the pointed-to-element.
 
constexpr seqan3::detail::matrix_coordinate coordinate () const noexcept
 Returns the current position of the iterator as a seqan3::detail::matrix_coordinate.
 
constexpr bool operator== (two_dimensional_matrix_iterator_base< other_derived_t, order > const &rhs) const noexcept
 Returns true if both iterators are equal, false otherwise.
 
constexpr bool operator!= (two_dimensional_matrix_iterator_base< other_derived_t, order > const &rhs) const noexcept
 Returns true if both iterators are unequal, false otherwise.
 
constexpr bool operator< (two_dimensional_matrix_iterator_base< other_derived_t, order > const &rhs) const noexcept
 Checks if lhs is smaller than rhs.
 
constexpr bool operator<= (two_dimensional_matrix_iterator_base< other_derived_t, order > const &rhs) const noexcept
 Checks if lhs is smaller than or equal to rhs.
 
constexpr bool operator> (two_dimensional_matrix_iterator_base< other_derived_t, order > const &rhs) const noexcept
 Checks if lhs is greater than rhs.
 
constexpr bool operator>= (two_dimensional_matrix_iterator_base< other_derived_t, order > const &rhs) const noexcept
 Checks if lhs is greater than or equal to rhs.
 
constexpr basic_iterator< const_range > & operator+= (matrix_offset const &offset) noexcept
 Advances the iterator by the given offset in the respective matrix dimensions.
 
constexpr basic_iterator< const_range > & operator+= (std::iter_difference_t< dummy_t > const offset) noexcept
 Advances the iterator by offset following the given matrix major order.
 
constexpr basic_iterator< const_range > & operator++ () noexcept
 Advances the iterator by one following the given matrix major order.
 
constexpr basic_iterator< const_range > operator++ (int) noexcept
 Returns an iterator incremented by one following the given matrix major order.
 
constexpr basic_iterator< const_range > operator+ (std::iter_difference_t< dummy_t > const offset) const noexcept
 Returns an iterator advanced by offset following the given matrix major order.
 
constexpr basic_iterator< const_range > operator+ (matrix_offset const &offset) const noexcept
 Returns an iterator advanced by offset in the respective dimensions.
 
constexpr basic_iterator< const_range > & operator-- () noexcept
 Advances the iterator by minus one following the given matrix major order.
 
constexpr basic_iterator< const_range > operator-- (int) noexcept
 Returns an iterator decremented by one following the given matrix major order.
 
constexpr basic_iterator< const_range > & operator-= (std::iter_difference_t< dummy_t > const offset) noexcept
 Advances the iterator by offset following the given matrix major order.
 
constexpr basic_iterator< const_range > & operator-= (matrix_offset const &offset) noexcept
 Returns an iterator advanced by offset in the respective dimensions.
 
constexpr basic_iterator< const_range > operator- (std::iter_difference_t< dummy_t > const offset) const noexcept
 Returns an iterator advanced by offset following the given matrix major order.
 
constexpr basic_iterator< const_range > operator- (matrix_offset const &offset) const noexcept
 Returns an iterator advanced by offset in the respective dimensions.
 

Private Types

using base_t = two_dimensional_matrix_iterator_base< basic_iterator, order >
 The base class type.
 
using parent_t = detail::maybe_const_range_t< const_range, two_dimensional_matrix >
 Type of the parent range.
 
using storage_iterator = detail::maybe_const_iterator_t< const_range, storage_type >
 The iterator of the underlying storage.
 

Private Attributes

storage_iterator host_iter {}
 The underlying storage iterator.
 
parent_tmatrix_ptr {nullptr}
 Points to the associated matrix.
 

Friends

template<bool other_const_range>
class basic_iterator
 Befriend the corresponding const iterator.
 
template<typename derived_t , matrix_major_order other_order>
class two_dimensional_matrix_iterator_base
 Befriend the base crtp class.
 

Additional Inherited Members

Detailed Description

template<typename value_t, typename allocator_t = std::allocator<value_t>, matrix_major_order order = matrix_major_order::row>
template<bool const_range>
class seqan3::detail::two_dimensional_matrix< value_t, allocator_t, order >::basic_iterator< const_range >

A two-dimensional matrix iterator.

Template Parameters
matrix_tThe underlying seqan3::detail::two_dimensional_matrix.

Offers a two-dimensional iterator interface over the seqan3::detail::two_dimensional_matrix, which stores the data in a flattened one-dimensional vector.

Constructor & Destructor Documentation

◆ basic_iterator()

template<typename value_t , typename allocator_t = std::allocator<value_t>, matrix_major_order order = matrix_major_order::row>
template<bool const_range>
constexpr seqan3::detail::two_dimensional_matrix< value_t, allocator_t, order >::basic_iterator< const_range >::basic_iterator ( parent_t matrix,
storage_iterator  iter 
)
inlineconstexpr

Construction from the underlying matrix and the iterator over actual storage.

Parameters
[in]matrixThe underlying matrix to access the corresponding dimensions.
[in]iterThe underlying iterator over the actual storage; must model std::random_access_iterator.

Member Function Documentation

◆ coordinate()

template<typename value_t , typename allocator_t = std::allocator<value_t>, matrix_major_order order = matrix_major_order::row>
template<bool const_range>
matrix_coordinate seqan3::detail::two_dimensional_matrix< value_t, allocator_t, order >::basic_iterator< const_range >::coordinate ( ) const
inlinenoexcept

Returns the current position of the iterator as a two-dimensional matrix coordinate.

Attention
This is a concept requirement, not an actual function (however types modelling this concept will provide an implementation).

Implements seqan3::detail::two_dimensional_matrix_iterator< iter_t >.

◆ operator+=()

template<typename value_t , typename allocator_t = std::allocator<value_t>, matrix_major_order order = matrix_major_order::row>
template<bool const_range>
constexpr derived_t & seqan3::detail::two_dimensional_matrix_iterator_base< derived_t, order >::operator+= ( matrix_offset const &  offset)
inlineconstexprnoexcept

Advances the iterator by the given offset in the respective matrix dimensions.

Parameters
[in]offsetThe matrix offset used to advance the iterator.
Returns
The advanced iterator.

Advances the given host iterator (the iterator over the one-dimensional vector) by the given matrix coordinate offset. Independent of the seqan3::detail::matrix_major_order the host iterator is advanced to the correct position within the underlying one-dimensional vector as if it where a two-dimensional matrix.

Note
This operator shall be implemented by the derived type and all other arithmetic operators will delegate to this operator.

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