SeqAn3
seqan3::alphabet_proxy< derived_type, alphabet_type > Class Template Reference

A CRTP-base that eases the definition of proxy types returned in place of regular alphabets. More...

#include <seqan3/alphabet/detail/alphabet_proxy.hpp>

Inheritance diagram for seqan3::alphabet_proxy< derived_type, alphabet_type >:
[legend]

Public Types

Member types
using rank_type = underlying_rank_t< alphabet_type >
 
using char_type = detail::transformation_trait_or_t< underlying_char< alphabet_type >, void >
 
using phred_type = detail::transformation_trait_or_t< underlying_phred< alphabet_type >, void >
 

Public Member Functions

Write functions

All of these call the emulated type's write functions and then delegate to the assignment operator which invokes derived behaviour.

constexpr derived_type & assign_rank (underlying_rank_t< alphabet_type > const r) noexcept
 
constexpr derived_type & assign_char (char_type_virtual const c) noexcept requires alphabet_concept< alphabet_type >
 
constexpr derived_type & assign_phred (phred_type_virtual const c) noexcept requires quality_concept< alphabet_type >
 
Read functions

All of these call the emulated type's read functions.

constexpr operator alphabet_type () const noexcept
 Implicit conversion to the emulated type.
 
constexpr char_type to_char () const noexcept requires alphabet_concept< alphabet_type >
 
constexpr phred_type to_phred () const noexcept requires quality_concept< alphabet_type >
 

Detailed Description

template<typename derived_type, typename alphabet_type>
class seqan3::alphabet_proxy< derived_type, alphabet_type >

A CRTP-base that eases the definition of proxy types returned in place of regular alphabets.

Template Parameters
derived_typeThe CRTP parameter type.
alphabet_typeThe type of the alphabet that this proxy emulates.

Certain containers and other data structure hold alphabet values in a non-standard way so they can convert to that alphabet when being accessed, but cannot return a reference to the held value. These data structures may instead return a proxy to the held value which still allows changing it (and updating the underlying data structure to reflect this).

This CRTP base facilitates the definition of such proxies. Most users of SeqAn will not need to understand the details.

This class ensures that the proxy itself also models seqan3::semi_alphabet_concept, seqan3::alphabet_concept, seqan3::quality_concept, seqan3::nucleotide_concept and/or seqan3::aminoacid_concept if the emulated type models these. This makes sure that function templates which accept the original, also accept the proxy. An exception are multi-layered compositions of alphabets where the proxy currently does not support access via get.

Implementation notes

The derived type needs to provide an .on_update() member function that performs the changes in the underlying data structure.

See seqan3::bitcompressed_vector or seqan3::cartesian_composition for examples of how this class is used.


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