SeqAn3
seqan3::nucleotide_base< derived_type, size > Class Template Reference

A CRTP-base that refines seqan3::alphabet_base and is used by the nucleotides. More...

#include <seqan3/alphabet/nucleotide/nucleotide_base.hpp>

Inheritance diagram for seqan3::nucleotide_base< derived_type, size >:
[legend]

Public Types

using char_type = char_t
 The type of the alphabet when converted to char (e.g. via to_char()).
 
using rank_type = detail::min_viable_uint_t< size - 1 >
 The type of the alphabet when represented as a number (e.g. via to_rank()).
 

Public Member Functions

Read functions
constexpr derived_type complement () const noexcept
 Return the complement of the letter. More...
 
Read functions
constexpr char_type to_char () const noexcept
 Return the letter as a character of char_type. More...
 
constexpr rank_type to_rank () const noexcept
 Return the letter's numeric value (rank in the alphabet). More...
 
Write functions
constexpr derived_type & assign_char (std::conditional_t< std::Same< char_type, void >, char, char_type > const c) noexcept
 Assign from a character. More...
 
constexpr derived_type & assign_rank (rank_type const c) noexcept
 Assign from a numeric value. More...
 

Static Public Attributes

static detail::min_viable_uint_t< size > constexpr value_size
 The size of the alphabet, i.e. the number of different values it can take.
 

Constructors, destructor and assignment

template<typename other_nucl_type >
constexpr nucleotide_base (other_nucl_type const &other) noexcept
 Allow explicit construction from any other nucleotide type and convert via the character representation.
 

Detailed Description

template<typename derived_type, auto size>
class seqan3::nucleotide_base< derived_type, size >

A CRTP-base that refines seqan3::alphabet_base and is used by the nucleotides.

Template Parameters
derived_typeThe CRTP parameter type.
sizeThe size of the alphabet.

You can use this class to define your own nucleotide alphabet, but types are not required to be based on it to model seqan3::nucleotide_concept, it is purely a way to avoid code duplication.

The derived type needs to define only the following table as static member variable:

  • static std::array<THAT_TYPE, value_size> complement_table that defines for every possible rank value the corresponding complement.

Member Function Documentation

◆ assign_char()

constexpr derived_type& seqan3::alphabet_base< derived_type, size, char >::assign_char ( std::conditional_t< std::Same< char_type, void >, char, char_type > const  c)
inlinenoexceptinherited

Assign from a character.

Satisfies the seqan3::alphabet_concept::assign_char() requirement via the seqan3::assign_char() wrapper.

Complexity

Constant.

Exceptions

Guaranteed not to throw.

◆ assign_rank()

constexpr derived_type& seqan3::alphabet_base< derived_type, size, char >::assign_rank ( rank_type const  c)
inlinenoexceptinherited

Assign from a numeric value.

Satisfies the seqan3::semi_alphabet_concept::assign_rank() requirement via the seqan3::assign_rank() wrapper.

Complexity

Constant.

Exceptions

Guaranteed not to throw.

◆ complement()

template<typename derived_type, auto size>
constexpr derived_type seqan3::nucleotide_base< derived_type, size >::complement ( ) const
inlinenoexcept

Return the complement of the letter.

See Nucleotide for the actual values.

Satisfies the seqan3::nucleotide_concept::complement() requirement via the seqan3::complement() wrapper.

Complexity

Constant.

Exceptions

Guaranteed not to throw.

◆ to_char()

constexpr char_type seqan3::alphabet_base< derived_type, size, char >::to_char ( ) const
inlinenoexceptinherited

Return the letter as a character of char_type.

Satisfies the seqan3::alphabet_concept::to_char() requirement via the seqan3::to_char() wrapper.

Complexity

Constant.

Exceptions

Guaranteed not to throw.

◆ to_rank()

constexpr rank_type seqan3::alphabet_base< derived_type, size, char >::to_rank ( ) const
inlinenoexceptinherited

Return the letter's numeric value (rank in the alphabet).

Satisfies the seqan3::semi_alphabet_concept::to_rank() requirement via the to_rank() wrapper.

Complexity

Constant.

Exceptions

Guaranteed not to throw.


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