SeqAn3  3.0.3
The Modern C++ library for sequence analysis.
seqan3::gap Class Reference

The alphabet of a gap character '-'. More...

#include <seqan3/alphabet/gap/gap.hpp>

+ Inheritance diagram for seqan3::gap:

Public Member Functions

Constructors, destructor and assignment
constexpr gap () noexcept
 Defaulted.
 
constexpr gap (gap const &)=default
 Defaulted.
 
constexpr gap (gap &&)=default
 Defaulted.
 
constexpr gapoperator= (gap const &)=default
 Defaulted.
 
constexpr gapoperator= (gap &&)=default
 Defaulted.
 
 ~gap ()=default
 Defaulted.
 
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 gapassign_char (char_type const c) noexcept
 Assign from a character, implicitly converts invalid characters. More...
 
constexpr gapassign_rank (rank_type const c) noexcept
 Assign from a numeric value. More...
 

Static Public Attributes

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

Protected Types

Member types
using char_type = std::conditional_t< std::same_as< char, void >, char, char >
 The char representation; conditional needed to make semi alphabet definitions legal. More...
 
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()). More...
 

Private Types

using base_t = alphabet_base< gap, 1, char >
 The base class.
 

Private Attributes

friend base_t
 Befriend seqan3::alphabet_base.
 
rank_type rank
 The value of the alphabet letter is stored as the rank.
 

Static Private Attributes

static constexpr char char_value = '-'
 The character that will be printed.
 

Related Functions

(Note that these are not member functions.)

Generic serialisation functions for all seqan3::semialphabet

All types that satisfy seqan3::semialphabet can be serialised via Cereal.

template<cereal_output_archive archive_t, semialphabet alphabet_t>
alphabet_rank_t< alphabet_t > save_minimal (archive_t const &, alphabet_t const &l)
 Save an alphabet letter to stream. More...
 

Detailed Description

The alphabet of a gap character '-'.

The alphabet always has the same value ('-').

#include <iostream>
int main()
{
seqan3::gap another_gap{};
another_gap.assign_char('A'); // this does not change anything
seqan3::debug_stream << my_gap.to_char(); // outputs '-'
if (my_gap.to_char() == another_gap.to_char())
seqan3::debug_stream << "Both gaps are the same!";
}
constexpr char_type to_char() const noexcept
Return the letter as a character of char_type.
Definition: alphabet_base.hpp:108
constexpr derived_type & assign_char(char_type const c) noexcept
Assign from a character, implicitly converts invalid characters.
Definition: alphabet_base.hpp:158
The alphabet of a gap character '-'.
Definition: gap.hpp:37
Provides seqan3::debug_stream and related types.
Provides seqan3::gap.
debug_stream_type debug_stream
A global instance of seqan3::debug_stream_type.
Definition: debug_stream.hpp:42

Member Typedef Documentation

◆ char_type

using seqan3::alphabet_base< gap , size, char >::char_type = std::conditional_t<std::same_as<char , void>, char, char >
protectedinherited

The char representation; conditional needed to make semi alphabet definitions legal.

We need a return type for seqan3::alphabet_base::to_char and seqan3::alphabet_base::assign_char other than void to make these in-class definitions valid when char_t is void.

This entity is stable. Since version 3.1.

◆ rank_type

using seqan3::alphabet_base< gap , size, char >::rank_type = detail::min_viable_uint_t<size - 1>
protectedinherited

The type of the alphabet when represented as a number (e.g. via to_rank()).

This entity is stable. Since version 3.1.

Member Function Documentation

◆ assign_char()

constexpr gap & seqan3::alphabet_base< gap , size, char >::assign_char ( char_type const  c)
inlineconstexprnoexceptinherited

Assign from a character, implicitly converts invalid characters.

Parameters
cThe character to be assigned.

Provides an implementation for seqan3::assign_char_to, required to model seqan3::alphabet.

Complexity

Constant.

Exceptions

Guaranteed not to throw.

This entity is stable. Since version 3.1.

◆ assign_rank()

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

Assign from a numeric value.

Parameters
cThe rank to be assigned.

Provides an implementation for seqan3::assign_rank_to, required to model seqan3::semialphabet.

Complexity

Constant.

Exceptions

Guaranteed not to throw.

This entity is stable. Since version 3.1.

◆ to_char()

constexpr char_type seqan3::alphabet_base< gap , size, char >::to_char ( ) const
inlineconstexprnoexceptinherited

Return the letter as a character of char_type.

Provides an implementation for seqan3::to_char, required to model seqan3::alphabet.

Complexity

Constant.

Exceptions

Guaranteed not to throw.

This entity is stable. Since version 3.1.

◆ to_rank()

constexpr rank_type seqan3::alphabet_base< gap , size, char >::to_rank ( ) const
inlineconstexprnoexceptinherited

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

Provides an implementation for seqan3::to_rank, required to model seqan3::semialphabet.

Complexity

Constant.

Exceptions

Guaranteed not to throw.

This entity is stable. Since version 3.1.

Friends And Related Function Documentation

◆ save_minimal()

template<cereal_output_archive archive_t, semialphabet alphabet_t>
alphabet_rank_t< alphabet_t > save_minimal ( archive_t const &  ,
alphabet_t const &  l 
)
related

Save an alphabet letter to stream.

Template Parameters
archive_tMust satisfy seqan3::cereal_output_archive.
alphabet_tType of l; must satisfy seqan3::semialphabet.
Parameters
lThe alphabet letter.

Delegates to seqan3::to_rank.

Attention
These functions are never called directly, see the Alphabet module on how to use serialisation.

This entity is stable. Since version 3.1.

Member Data Documentation

◆ alphabet_size

constexpr detail::min_viable_uint_t<size> seqan3::alphabet_base< gap , size, char >::alphabet_size
staticconstexprinherited

The size of the alphabet, i.e. the number of different values it can take.

This entity is stable. Since version 3.1.


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