SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
core/configuration/detail/concept.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
12#include <array>
13#include <concepts>
14#include <functional>
15#include <type_traits>
16
18
19namespace seqan3
20{
22// Forward declarations
23struct pipeable_config_element;
25} // namespace seqan3
26
27namespace seqan3::detail
28{
29
30// ----------------------------------------------------------------------------
31// compatibility_table
32// ----------------------------------------------------------------------------
33
39template <typename algorithm_id_type>
40inline constexpr std::array<std::array<void *, 0>, 0> compatibility_table{};
41
42// ----------------------------------------------------------------------------
43// Concept config_element
44// ----------------------------------------------------------------------------
45
64template <typename config_t>
65concept config_element = requires {
66 requires std::is_base_of_v<seqan3::pipeable_config_element, config_t>;
67 requires std::copyable<config_t>;
68 { config_t::id };
69};
71
88template <typename config1_t, typename config2_t>
89concept config_element_pipeable_with =
90 config_element<config1_t> && config_element<config2_t>
91 && std::same_as<std::remove_cvref_t<decltype(config1_t::id)>, std::remove_cvref_t<decltype(config2_t::id)>>
92 && compatibility_table<std::remove_cvref_t<decltype(config1_t::id)>>[static_cast<int32_t>(config1_t::id)]
93 [static_cast<int32_t>(config2_t::id)];
95
96} // namespace seqan3::detail
97
98namespace seqan3
99{
101// Forward declaration.
102template <detail::config_element... configs_t>
103class configuration;
105
126template <typename config1_t, typename config2_t>
127inline constexpr bool is_config_element_combineable_v = detail::config_element_pipeable_with<config1_t, config2_t>;
128
130// Specialised for config2_t == seqan3::configuration
131template <typename config1_t, typename... configs2_t>
132inline constexpr bool is_config_element_combineable_v<config1_t, configuration<configs2_t...>> =
133 (detail::config_element_pipeable_with<config1_t, configs2_t> && ...);
134
135// Specialised for config1_t == seqan3::configuration
136template <typename... configs1_t, typename config2_t>
137inline constexpr bool is_config_element_combineable_v<configuration<configs1_t...>, config2_t> =
138 (detail::config_element_pipeable_with<configs1_t, config2_t> && ...);
139
140// Specialised for config1_t == seqan3::configuration && config2_t == seqan3::configuration
141template <typename... configs1_t, typename... configs2_t>
142inline constexpr bool is_config_element_combineable_v<configuration<configs1_t...>, configuration<configs2_t...>> =
143 (is_config_element_combineable_v<configs1_t, configuration<configs2_t...>> && ...);
145
146} // namespace seqan3
Collection of elements to configure an algorithm.
Definition configuration.hpp:42
constexpr bool is_config_element_combineable_v
Helper variable template to test if a configuration element is combineable with another configuration...
Definition core/configuration/detail/concept.hpp:127
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
Provides type traits for working with templates.
Hide me