Loading...
Searching...
No Matches
alphabet/aminoacid/concept.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 <type_traits>
#include <seqan3/alphabet/concept.hpp>
#include <seqan3/core/detail/template_inspection.hpp>
// ============================================================================
// aminoacid_empty_base
// ============================================================================
namespace seqan3
{
struct aminoacid_empty_base
{};
} // namespace seqan3
// ============================================================================
// enable_aminoacid
// ============================================================================
namespace seqan3::detail::adl_only
{
template <typename... args_t>
void enable_aminoacid(args_t...) = delete;
template <typename alphabet_t>
struct enable_aminoacid_cpo : public detail::customisation_point_object<enable_aminoacid_cpo<alphabet_t>, 2>
{
using base_t = detail::customisation_point_object<enable_aminoacid_cpo<alphabet_t>, 2>;
using base_t::base_t;
template <typename alphabet_type>
using alphabet_or_type_identity =
std::conditional_t<std::is_nothrow_default_constructible_v<std::remove_cvref_t<alphabet_type>>
&& seqan3::is_constexpr_default_constructible_v<std::remove_cvref_t<alphabet_type>>,
std::remove_cvref_t<alphabet_type>,
std::type_identity<alphabet_type>>;
template <typename alphabet_type = alphabet_t>
static constexpr auto SEQAN3_CPO_OVERLOAD(priority_tag<2>)(
/*return*/ std::bool_constant<seqan3::custom::alphabet<alphabet_type>::enable_aminoacid>::value == true /*;*/
);
template <typename alphabet_type = alphabet_t>
static constexpr auto SEQAN3_CPO_OVERLOAD(priority_tag<1>)(
/*return*/ std::bool_constant<enable_aminoacid(alphabet_or_type_identity<alphabet_type>{})>::value == true /*;*/
);
template <typename alphabet_type = alphabet_t>
static constexpr auto SEQAN3_CPO_OVERLOAD(priority_tag<0>)(
/*return*/ std::is_base_of_v<seqan3::aminoacid_empty_base, alphabet_type> == true /*;*/
);
};
} // namespace seqan3::detail::adl_only
namespace seqan3
{
template <typename t>
inline constexpr bool enable_aminoacid =
detail::adl_only::enable_aminoacid_cpo<std::remove_cvref_t<t>>::cpo_overload(detail::priority_tag<2>{});
// ============================================================================
// concept
// ============================================================================
template <typename type>
concept aminoacid_alphabet = alphabet<type> && enable_aminoacid<type>;
} // namespace seqan3
concept.hpp
Core alphabet concept and free function/type trait wrappers.
std::conditional_t
SEQAN3_CPO_OVERLOAD
#define SEQAN3_CPO_OVERLOAD(...)
A macro that helps to define a seqan3::detail::customisation_point_object.
Definition customisation_point.hpp:106
seqan3::enable_aminoacid
constexpr bool enable_aminoacid
A trait that indicates whether a type shall model seqan3::aminoacid_alphabet.
Definition alphabet/aminoacid/concept.hpp:143
std::bool_constant
alphabet
The generic alphabet concept that covers most data types used in ranges.
aminoacid_alphabet
A concept that indicates whether an alphabet represents amino acids.
std::is_base_of_v
T is_base_of_v
seqan3
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
seqan3::aminoacid_empty_base
This is an empty base class that can be inherited by types that shall model seqan3::aminoacid_alphabe...
Definition alphabet/aminoacid/concept.hpp:32
template_inspection.hpp
Provides type traits for working with templates.
type_traits
Hide me