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 {
69 config_t::id
70 };
71 };
73
90template <typename config1_t, typename config2_t>
91concept config_element_pipeable_with =
92 config_element<config1_t> && config_element<config2_t>
93 && std::same_as<std::remove_cvref_t<decltype(config1_t::id)>, std::remove_cvref_t<decltype(config2_t::id)>>
94 && compatibility_table<std::remove_cvref_t<decltype(config1_t::id)>>
95[static_cast<int32_t>(config1_t::id)][static_cast<int32_t>(config2_t::id)];
97
98} // namespace seqan3::detail
99
100namespace seqan3
101{
103// Forward declaration.
104template <detail::config_element... configs_t>
105class configuration;
107
128template <typename config1_t, typename config2_t>
129inline constexpr bool is_config_element_combineable_v = detail::config_element_pipeable_with<config1_t, config2_t>;
130
132// Specialised for config2_t == seqan3::configuration
133template <typename config1_t, typename... configs2_t>
134inline constexpr bool is_config_element_combineable_v<config1_t, configuration<configs2_t...>> =
135 (detail::config_element_pipeable_with<config1_t, configs2_t> && ...);
136
137// Specialised for config1_t == seqan3::configuration
138template <typename... configs1_t, typename config2_t>
139inline constexpr bool is_config_element_combineable_v<configuration<configs1_t...>, config2_t> =
140 (detail::config_element_pipeable_with<configs1_t, config2_t> && ...);
141
142// Specialised for config1_t == seqan3::configuration && config2_t == seqan3::configuration
143template <typename... configs1_t, typename... configs2_t>
144inline constexpr bool is_config_element_combineable_v<configuration<configs1_t...>, configuration<configs2_t...>> =
145 (is_config_element_combineable_v<configs1_t, configuration<configs2_t...>> && ...);
147
148} // 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:129
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
Provides type traits for working with templates.
Hide me