SeqAn3  3.0.2
The Modern C++ library for sequence analysis.
configuration_utility.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2020, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2020, 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 <type_traits>
17 
18 #include <meta/meta.hpp>
19 
23 
24 namespace seqan3::detail
25 {
26 
27 // ----------------------------------------------------------------------------
28 // compatibility_table
29 // ----------------------------------------------------------------------------
30 
36 template <typename algorithm_id_type>
37 inline constexpr std::array<std::array<void, 0>, 0> compatibility_table;
38 
39 // ----------------------------------------------------------------------------
40 // Type trait is_configuration_valid
41 // ----------------------------------------------------------------------------
42 
54 template <config_element_specialisation query_t, config_element_specialisation ... compare_types>
55 struct is_configuration_valid :
56  public std::conditional_t<
57  (std::is_same_v<std::remove_cvref_t<decltype(query_t::id)>, std::remove_cvref_t<decltype(compare_types::id)>> && ...) &&
58  (compatibility_table<std::remove_cvref_t<decltype(query_t::id)>>
59  [static_cast<std::underlying_type_t<std::remove_cvref_t<decltype(query_t::id)>>>(query_t::id)]
60  [static_cast<std::underlying_type_t<std::remove_cvref_t<decltype(query_t::id)>>>(compare_types::id)] && ...),
61  std::true_type, // If condition is true.
62  std::false_type // If condition is false.
63  >
64 {};
65 
70 template <typename query_t, typename ...compare_types>
71 inline constexpr bool is_configuration_valid_v = is_configuration_valid<query_t, compare_types...>::value;
72 
73 // ----------------------------------------------------------------------------
74 // Metafunction is_same_configuration_f
75 // ----------------------------------------------------------------------------
76 
84 template <template <typename ...> typename query_t>
85 struct is_same_configuration_f
86 {
91  template <typename compare_type>
92  using invoke = is_type_specialisation_of<compare_type, query_t>;
93 };
94 
95 } // namespace seqan3::detail
tuple.hpp
Provides seqan3::tuple_like.
std::invoke
T invoke(T... args)
concept.hpp
Provides concepts for the configuration classes.
array
std::conditional_t
type_list.hpp
Provides seqan3::type_list.