BioC++ core-0.7.0
The Modern C++ libraries for Bioinformatics.
 
Loading...
Searching...
No Matches
bio::alphabet::mask Class Reference

Implementation of a masked semialphabet to be used for tuple composites.. More...

#include <bio/alphabet/mask/mask.hpp>

+ Inheritance diagram for bio::alphabet::mask:

Public Member Functions

Constructors, destructor and assignment
constexpr mask ()=default
 Defaulted.
 
constexpr mask (mask const &)=default
 Defaulted.
 
constexpr mask (mask &&) noexcept=default
 Defaulted.
 
constexpr maskoperator= (mask const &)=default
 Defaulted.
 
constexpr maskoperator= (mask &&) noexcept=default
 Defaulted.
 
 ~mask ()=default
 
Read functions
constexpr char_type to_char () const noexcept
 Return the letter as a character of char_type.
 
constexpr rank_type to_rank () const noexcept
 Return the letter's numeric value (rank in the alphabet).
 
Write functions
constexpr maskassign_char (char_type const c) noexcept
 Assign from a character, implicitly converts invalid characters.
 
constexpr maskassign_rank (rank_type const c) noexcept
 Assign from a numeric value.
 

Static Public Attributes

static constexpr size_t alphabet_size
 The size of the alphabet, i.e. the number of different values it can take.
 
Boolean values

Static member "booleans" that can be assigned to the alphabet or used in aggregate initialization.

Similar to an Enum interface.

static const mask UNMASKED {mask{}.assign_rank(0)}
 Member for UNMASKED.
 
static const mask MASKED {mask{}.assign_rank(1)}
 

Protected Types

Member types
using char_type = std::conditional_t< std::same_as< void, void >, char, void >
 The char representation; conditional needed to make semi alphabet definitions legal.
 
using rank_type = meta::detail::min_viable_uint_t< size - 1 >
 The type of the alphabet when represented as a number (e.g. via to_rank()).
 

Detailed Description

Implementation of a masked semialphabet to be used for tuple composites.

.

This alphabet is not usually used directly, but instead via bio::alphabet::masked. For more information see the Mask submodule .

int main()
{
bio::alphabet::mask another_mask{};
my_mask.assign_rank(false); // will assign my_mask the value mask::UNMASKED
another_mask.assign_rank(0); // will also assign another_mask the value mask::UNMASKED
if (my_mask.to_rank() == another_mask.to_rank())
fmt::print("Both are UNMASKED!\n");
}
constexpr derived_type & assign_rank(rank_type const c) noexcept
Assign from a numeric value.
Definition: base.hpp:168
constexpr rank_type to_rank() const noexcept
Return the letter's numeric value (rank in the alphabet).
Definition: base.hpp:124
Implementation of a masked semialphabet to be used for tuple composites..
Definition: mask.hpp:37
static const mask MASKED
Definition: mask.hpp:63
Core alphabet concept and free function/type trait wrappers.
Create a mask composite which can be applied with another alphabet.

Constructor & Destructor Documentation

◆ ~mask()

bio::alphabet::mask::~mask ( )
default

Defaulted.

Member Function Documentation

◆ assign_char()

constexpr mask & bio::alphabet::base< mask , size, void >::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 bio::alphabet::assign_char_to, required to model bio::alphabet::alphabet.

Complexity

Constant.

Exceptions

Guaranteed not to throw.

◆ assign_rank()

constexpr mask & bio::alphabet::base< mask , size, void >::assign_rank ( rank_type const  c)
inlineconstexprnoexceptinherited

Assign from a numeric value.

Parameters
cThe rank to be assigned.

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

Complexity

Constant.

Exceptions

Guaranteed not to throw.

◆ to_char()

constexpr char_type bio::alphabet::base< mask , size, void >::to_char ( ) const
inlineconstexprnoexceptinherited

Return the letter as a character of char_type.

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

Complexity

Constant.

Exceptions

Guaranteed not to throw.

◆ to_rank()

constexpr rank_type bio::alphabet::base< mask , size, void >::to_rank ( ) const
inlineconstexprnoexceptinherited

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

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

Complexity

Constant.

Exceptions

Guaranteed not to throw.

Member Data Documentation

◆ MASKED

constexpr mask bio::alphabet::mask::MASKED {mask{}.assign_rank(1)}
staticconstexpr

Member for MASKED.


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