A CRTP-base that eases the definition of proxy types returned in place of regular alphabets. More...
#include <seqan3/alphabet/detail/alphabet_proxy.hpp>
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 (alphabet_rank_t< alphabet_type > const r) noexcept |
Assigns a rank. | |
constexpr derived_type & | assign_char (char_type const c) noexcept |
Assigns a character. | |
constexpr derived_type & | assign_phred (phred_type const c) noexcept |
Assigns a Phred score. | |
Static Public Attributes | |
static constexpr auto | alphabet_size = seqan3::alphabet_size<alphabet_type> |
The alphabet size. | |
Comparison operators | |
These are only required if the emulated type allows comparison with types it is not convertible to, e.g. seqan3::alphabet_variant. | |
template<typename t > | |
constexpr friend auto | operator== (derived_type const lhs, t const rhs) noexcept -> std::enable_if_t< is_alphabet_comparable_with< t >, bool > |
Allow (in-)equality comparison with types that the emulated type is comparable with. | |
template<typename t > | |
constexpr friend auto | operator== (t const lhs, derived_type const rhs) noexcept -> std::enable_if_t< is_alphabet_comparable_with< t >, bool > |
Allow (in-)equality comparison with types that the emulated type is comparable with. | |
template<typename t > | |
constexpr friend auto | operator!= (derived_type const lhs, t const rhs) noexcept -> std::enable_if_t< is_alphabet_comparable_with< t >, bool > |
Allow (in-)equality comparison with types that the emulated type is comparable with. | |
template<typename t > | |
constexpr friend auto | operator!= (t const lhs, derived_type const rhs) noexcept -> std::enable_if_t< is_alphabet_comparable_with< t >, bool > |
Allow (in-)equality comparison with types that the emulated type is comparable with. | |
A CRTP-base that eases the definition of proxy types returned in place of regular alphabets.
derived_type | The CRTP parameter type. |
alphabet_type | The type of the alphabet that this proxy emulates; must model at least seqan3::writable_semialphabet and std::regular. |
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::semialphabet, seqan3::alphabet, seqan3::quality_alphabet, seqan3::nucleotide_alphabet and/or seqan3::aminoacid_alphabet if the emulated type models these. This makes sure that function templates which accept the original, also accept the proxy.
The derived type needs to provide an .on_update()
member function that performs the changes in the underlying data structure.
See seqan3::bitpacked_sequence or seqan3::alphabet_tuple_base for examples of how this class is used.