Loading...
Searching...
No Matches
cigar_operation.hpp
Go to the documentation of this file.
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: BSD-3-Clause
#pragma once
#include <seqan3/alphabet/alphabet_base.hpp>
// ------------------------------------------------------------------
// cigar_operation
// ------------------------------------------------------------------
namespace seqan3::exposition_only
{
class cigar_operation : public alphabet_base<cigar_operation, 9, char>
{
private:
using base_t = alphabet_base<cigar_operation, 9, char>;
friend base_t;
public:
constexpr cigar_operation() noexcept = default;
constexpr cigar_operation(cigar_operation const &) noexcept = default;
constexpr cigar_operation(cigar_operation &&) noexcept = default;
constexpr cigar_operation & operator=(cigar_operation const &) noexcept = default;
constexpr cigar_operation & operator=(cigar_operation &&) noexcept = default;
~cigar_operation() noexcept = default;
private:
static constexpr char_type rank_to_char_table[alphabet_size]{'M', 'D', 'I', 'S', 'H', 'N', 'P', 'X', '='};
static constexpr std::array<rank_type, 256> char_to_rank_table{[]() constexpr
{
std::array<rank_type, 256> ret{};
// reverse mapping for characters
for (size_t rnk = 0u; rnk < alphabet_size; ++rnk)
{
ret[rank_to_char_table[rnk]] = rnk;
}
return ret;
}()}; // namespace seqan3::exposition_only
static constexpr char_type rank_to_char(rank_type const rank)
{
return rank_to_char_table[rank];
}
static constexpr rank_type char_to_rank(char_type const chr)
{
using index_t = std::make_unsigned_t<char_type>;
return char_to_rank_table[static_cast<index_t>(chr)];
}
};
} // namespace seqan3::exposition_only
alphabet_base.hpp
Provides seqan3::alphabet_base.
std::array
seqan3::alphabet_base< cigar_operation, 9, char >::alphabet_base
constexpr alphabet_base() noexcept=default
seqan3::alphabet_base< cigar_operation, 9, char >::rank_type
detail::min_viable_uint_t< size - 1 > rank_type
Definition alphabet_base.hpp:77
seqan3::alphabet_base< cigar_operation, 9, char >::alphabet_size
static constexpr detail::min_viable_uint_t< size > alphabet_size
Definition alphabet_base.hpp:196
seqan3::alphabet_base< cigar_operation, 9, char >::char_type
std::conditional_t< std::same_as< char, void >, char, char > char_type
Definition alphabet_base.hpp:69
seqan3::exposition_only::cigar_operation::cigar_operation
constexpr cigar_operation() noexcept=default
Defaulted.
seqan3::alphabet_size
constexpr auto alphabet_size
A type trait that holds the size of a (semi-)alphabet.
Definition alphabet/concept.hpp:834
seqan3::exposition_only
A namespace for SeqAn entities that are intended for documentation purposes only.
Definition cigar_operation.hpp:19
Hide me