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

A crtp-base class for iterators over seqan3::detail::two_dimensional_matrix. More...

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

+ Inheritance diagram for seqan3::detail::two_dimensional_matrix_iterator_base< derived_t, order >:

Public Member Functions

Element access
template<typename dummy_t = derived_t>
constexpr reference< dummy_t > operator* () const noexcept
 Returns a reference to the pointed to element.
 
template<typename dummy_t = derived_t>
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.
 
template<typename dummy_t = derived_t>
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.
 
template<typename dummy_t = derived_t>
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.
 
Comparison operators
template<typename other_derived_t >
requires std::constructible_from<derived_t, other_derived_t> || std::constructible_from<other_derived_t, derived_t>
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.
 
template<typename other_derived_t >
requires std::constructible_from<derived_t, other_derived_t> || std::constructible_from<other_derived_t, derived_t>
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.
 
template<typename other_derived_t >
requires std::constructible_from<derived_t, other_derived_t> || std::constructible_from<other_derived_t, derived_t>
constexpr bool operator< (two_dimensional_matrix_iterator_base< other_derived_t, order > const &rhs) const noexcept
 Checks if lhs is smaller than rhs.
 
template<typename other_derived_t >
requires std::constructible_from<derived_t, other_derived_t> || std::constructible_from<other_derived_t, derived_t>
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.
 
template<typename other_derived_t >
requires std::constructible_from<derived_t, other_derived_t> || std::constructible_from<other_derived_t, derived_t>
constexpr bool operator> (two_dimensional_matrix_iterator_base< other_derived_t, order > const &rhs) const noexcept
 Checks if lhs is greater than rhs.
 
template<typename other_derived_t >
requires std::constructible_from<derived_t, other_derived_t> || std::constructible_from<other_derived_t, derived_t>
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.
 

Private Types

template<typename _derived_t >
using difference_type = typename _derived_t::difference_type
 Helper template definition to get the difference type of the derived type.
 
template<typename _derived_t >
using pointer = typename _derived_t::pointer
 Helper template definition to get the pointer type of the derived type.
 
template<typename _derived_t >
using reference = typename _derived_t::reference
 Helper template definition to get the reference type of the derived type.
 

Private Member Functions

constexpr derived_tas_derived ()
 Cast this to derived type.
 
constexpr derived_t const & as_derived () const
 Cast this to derived type.
 
constexpr auto const & as_host_iter () const
 Return the host_iter of the derived type.
 
Constructors, destructor and assignment
constexpr two_dimensional_matrix_iterator_base ()=default
 Defaulted.
 
constexpr two_dimensional_matrix_iterator_base (two_dimensional_matrix_iterator_base const &)=default
 Defaulted.
 
constexpr two_dimensional_matrix_iterator_base (two_dimensional_matrix_iterator_base &&)=default
 Defaulted.
 
constexpr two_dimensional_matrix_iterator_baseoperator= (two_dimensional_matrix_iterator_base const &)=default
 Defaulted.
 
constexpr two_dimensional_matrix_iterator_baseoperator= (two_dimensional_matrix_iterator_base &&)=default
 Defaulted.
 
 ~two_dimensional_matrix_iterator_base ()=default
 Defaulted.
 

Private Attributes

friend derived_t
 Befriend the derived type.
 

Friends

template<typename other_derived_t , matrix_major_order other_order>
class two_dimensional_matrix_iterator_base
 Befriend other base class types for const iterator compatibility.
 

Arithmetic operators

template<typename dummy_t = derived_t>
constexpr friend derived_t operator+ (std::iter_difference_t< dummy_t > const offset, derived_t const iter)
 Returns an iterator advanced by offset following the given matrix major order.
 
constexpr friend derived_t operator+ (matrix_offset const &offset, derived_t const iter)
 Returns an iterator advanced by offset in the respective dimensions.
 
template<typename dummy_t = derived_t>
constexpr std::iter_difference_t< dummy_t > operator- (derived_t const lhs, derived_t const rhs) noexcept
 Returns the distance between two iterators.
 
constexpr derived_toperator+= (matrix_offset const &offset) noexcept
 Advances the iterator by the given offset in the respective matrix dimensions.
 
constexpr derived_toperator++ () noexcept
 Advances the iterator by one following the given matrix major order.
 
constexpr derived_t operator++ (int) noexcept
 Returns an iterator incremented by one following the given matrix major order.
 
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.
 
template<typename dummy_t = derived_t>
constexpr derived_t operator+ (std::iter_difference_t< dummy_t > const offset) const noexcept
 Returns an iterator advanced by offset following the given matrix major order.
 
constexpr derived_t operator+ (matrix_offset const &offset) const noexcept
 Returns an iterator advanced by offset in the respective dimensions.
 
constexpr derived_toperator-- () noexcept
 Advances the iterator by minus one following the given matrix major order.
 
constexpr derived_t operator-- (int) noexcept
 Returns an iterator decremented by one following the given matrix major order.
 
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.
 
template<typename dummy_t = derived_t>
constexpr derived_t operator- (std::iter_difference_t< dummy_t > const offset) const noexcept
 Returns an iterator advanced by offset following the given matrix major order.
 
constexpr derived_toperator-= (matrix_offset const &offset) noexcept
 Returns an iterator advanced by offset in the respective dimensions.
 
constexpr derived_t operator- (matrix_offset const &offset) const noexcept
 Returns an iterator advanced by offset in the respective dimensions.
 

Additional Inherited Members

Detailed Description

template<typename derived_t, matrix_major_order order>
class seqan3::detail::two_dimensional_matrix_iterator_base< derived_t, order >

A crtp-base class for iterators over seqan3::detail::two_dimensional_matrix.

Template Parameters
derived_tThe derived type that implements this base iterator.
orderThe seqan3::detail::matrix_major_order to use.
Note
This is a crtp_base class and cannot be instantiated directly. You need to define an iterator type that implements this abstract base class.

This iterator provides a two-dimensional access interface over the seqan3::detail::two_dimensional_matrix, which stores the values in a one-dimensional vector. In addition to the regular interface using seqan3::detail::two_dimensional_matrix_iterator_base::difference_type<dummy_t> this iterator offers special operators for advancing the iterator in a two-dimensional layout using seqan3::detail::matrix_offset. The underlying iterator is moved along the respective row and column offset according to the specialised seqan3::detail::matrix_major_order.

The regular interface moves the wrapped iterator according to the specified seqan3::detail::matrix_major_order, i.e. if order is seqan3::detail::matrix_major_order::column it advances the iterator first in vertical dimension and second in horizontal dimension and if order is seqan3::detail::matrix_major_order::row the other way around.

Requirements of the derived type

Types that implement this abstract base class must provide the associated types for iterators and shall implement the following functions in order to work properly:

Member Function Documentation

◆ as_derived()

template<typename derived_t , matrix_major_order order>
constexpr derived_t const & seqan3::detail::two_dimensional_matrix_iterator_base< derived_t, order >::as_derived ( ) const
inlineconstexprprivate

Cast this to derived type.

◆ coordinate()

template<typename derived_t , matrix_major_order order>
constexpr seqan3::detail::matrix_coordinate seqan3::detail::two_dimensional_matrix_iterator_base< derived_t, order >::coordinate ( ) const
inlineconstexprnoexcept

Returns the current position of the iterator as a seqan3::detail::matrix_coordinate.

The position of the iterator is stored as a seqan3::detail::matrix_coordinate mapping the one-dimensional vector position to a two-dimensional point coordinate.

Note
This function shall be implented in the derived type.

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

◆ operator+=()

template<typename derived_t , matrix_major_order order>
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