SeqAn3 3.3.0
The Modern C++ library for sequence analysis.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
core/configuration/detail/concept.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2023, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2023, Knut Reinert & MPI für molekulare Genetik
4// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5// shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6// -----------------------------------------------------------------------------------------------------
7
13#pragma once
14
15#include <array>
16#include <concepts>
17#include <functional>
18#include <type_traits>
19
21
22namespace seqan3
23{
25// Forward declarations
26struct pipeable_config_element;
28} // namespace seqan3
29
30namespace seqan3::detail
31{
32
33// ----------------------------------------------------------------------------
34// compatibility_table
35// ----------------------------------------------------------------------------
36
42template <typename algorithm_id_type>
43inline constexpr std::array<std::array<void *, 0>, 0> compatibility_table{};
44
45// ----------------------------------------------------------------------------
46// Concept config_element
47// ----------------------------------------------------------------------------
48
67template <typename config_t>
68concept config_element = requires {
69 requires std::is_base_of_v<seqan3::pipeable_config_element, config_t>;
70 requires std::copyable<config_t>;
71 {
72 config_t::id
73 };
74 };
76
93template <typename config1_t, typename config2_t>
94concept config_element_pipeable_with =
95 config_element<config1_t> && config_element<config2_t>
96 && std::same_as<std::remove_cvref_t<decltype(config1_t::id)>, std::remove_cvref_t<decltype(config2_t::id)>>
97 && compatibility_table<std::remove_cvref_t<decltype(config1_t::id)>>
98[static_cast<int32_t>(config1_t::id)][static_cast<int32_t>(config2_t::id)];
100
101} // namespace seqan3::detail
102
103namespace seqan3
104{
106// Forward declaration.
107template <detail::config_element... configs_t>
108class configuration;
110
131template <typename config1_t, typename config2_t>
132inline constexpr bool is_config_element_combineable_v = detail::config_element_pipeable_with<config1_t, config2_t>;
133
135// Specialised for config2_t == seqan3::configuration
136template <typename config1_t, typename... configs2_t>
137inline constexpr bool is_config_element_combineable_v<config1_t, configuration<configs2_t...>> =
138 (detail::config_element_pipeable_with<config1_t, configs2_t> && ...);
139
140// Specialised for config1_t == seqan3::configuration
141template <typename... configs1_t, typename config2_t>
142inline constexpr bool is_config_element_combineable_v<configuration<configs1_t...>, config2_t> =
143 (detail::config_element_pipeable_with<configs1_t, config2_t> && ...);
144
145// Specialised for config1_t == seqan3::configuration && config2_t == seqan3::configuration
146template <typename... configs1_t, typename... configs2_t>
147inline constexpr bool is_config_element_combineable_v<configuration<configs1_t...>, configuration<configs2_t...>> =
148 (is_config_element_combineable_v<configs1_t, configuration<configs2_t...>> && ...);
150
151} // namespace seqan3
Collection of elements to configure an algorithm.
Definition: configuration.hpp:45
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:132
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
Provides type traits for working with templates.