template<typename
derived_t>
class seqan3::detail::alignment_matrix_column_major_range_base< derived_t >
Provides a range interface for alignment matrices.
- Template Parameters
-
derived_t | The derived type implementing the data model of the matrix (see details for more information). |
This crtp-base class provides a range based interface for alignment matrices. It generates a range of ranges, where both the outer range and the inner ranges model std::ranges::input_range. The interface uses a column-major-order to iterate over the matrix, i.e. the outer range iterates over the columns and the inner range over the num_rows of each column. In addition, the inner range type, also referred to as alignment-column
, must model std::ranges::view. It is a shallow wrapper around the actual column stored in the derived_t
, who implements the corresponding data model. The current alignment-column is created within the derived_t
when the iterator over the outer range is dereferenced. The iterator over the resulting alignment-column
is further refined by the derived_t
to implement the actual behavior of the underlying alignment matrix.
Requirements of the derived type
This base class requires the following functions and types defined within the derived type in order to customise the returned type over the underlying matrix.
The following functions are not mandatory but can be overriden by the derived type:
Example
{
public:
friend base_t;
using typename base_t::alignment_column_type;
using reference = int &;
my_matrix() = default;
my_matrix(my_matrix const &) = default;
my_matrix(my_matrix &&) = default;
my_matrix &
operator=(my_matrix
const &) =
default;
my_matrix &
operator=(my_matrix &&) =
default;
~my_matrix() = default;
my_matrix(size_t const num_rows, size_t const num_cols) : num_rows{num_rows}, num_cols{num_cols}
{
data.resize(num_rows * num_cols);
}
protected:
size_t num_rows{};
size_t num_cols{};
{
return alignment_column_type{*this,
}
template <std::random_access_iterator iter_t>
constexpr reference
make_proxy(iter_t iter)
noexcept
{
return *iter;
}
};
int main()
{
my_matrix matrix{3, 5};
int val = 0;
for (auto col : matrix)
for (auto & cell : col)
cell = val++;
for (auto col : matrix)
}
Provides seqan3::detail::alignment_matrix_column_major_range_base.
Provides a range interface for alignment matrices.
Definition: alignment_matrix_column_major_range_base.hpp:63
typedef column_data_view_type
The view over the current alignment-column; must model std::ranges::view and std::ranges::input_range...
Definition: alignment_matrix_column_major_range_base.hpp:424
constexpr alignment_matrix_column_major_range_base & operator=(alignment_matrix_column_major_range_base const &)=default
Defaulted.
alignment_column_type initialise_column(size_t column_index)
Returns the current alignment-column at the given column_index.
Definition: alignment_matrix_column_major_range_base.hpp:450
typedef value_type
The proxy type of an alignment matrix.
Definition: alignment_matrix_column_major_range_base.hpp:419
value_type make_proxy(iter_t host_iter) noexcept
Creates the proxy value returned when dereferencing the alignment-column-iterator.
Definition: alignment_matrix_column_major_range_base.hpp:436
Provides seqan3::debug_stream and related types.
debug_stream_type debug_stream
A global instance of seqan3::debug_stream_type.
Definition: debug_stream.hpp:37