SeqAn3 3.2.0
The Modern C++ library for sequence analysis.
search_traits.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2022, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2022, 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
14#pragma once
15
23
24namespace seqan3::detail
25{
26
32template <typename search_configuration_t>
33struct search_traits
34{
36 using empty_search_result_type = search_result<empty_type, empty_type, empty_type, empty_type>;
38 using search_result_type = typename std::remove_cvref_t<decltype(std::declval<search_configuration_t>().get_or(
39 search_cfg::detail::result_type<empty_search_result_type>{}))>::type;
40
42 static constexpr bool has_max_error_total = search_configuration_t::template exists<search_cfg::max_error_total>();
44 static constexpr bool has_max_error_substitution =
45 search_configuration_t::template exists<search_cfg::max_error_substitution>();
47 static constexpr bool has_max_error_insertion =
48 search_configuration_t::template exists<search_cfg::max_error_insertion>();
50 static constexpr bool has_max_error_deletion =
51 search_configuration_t::template exists<search_cfg::max_error_deletion>();
52
54 static constexpr bool only_max_error_total =
55 has_max_error_total && !has_max_error_substitution && !has_max_error_insertion && !has_max_error_deletion;
56
58 static constexpr bool search_all_hits = search_configuration_t::template exists<search_cfg::hit_all>();
60 static constexpr bool search_single_best_hit =
61 search_configuration_t::template exists<search_cfg::hit_single_best>();
63 static constexpr bool search_all_best_hits = search_configuration_t::template exists<search_cfg::hit_all_best>();
65 static constexpr bool search_strata_hits = search_configuration_t::template exists<search_cfg::hit_strata>();
67 static constexpr bool has_hit_configuration = search_all_hits || search_single_best_hit || search_all_best_hits
68 || search_strata_hits
69 || search_configuration_t::template exists<search_cfg::hit>();
70
72 static constexpr bool output_query_id = search_configuration_t::template exists<search_cfg::output_query_id>();
74 static constexpr bool output_reference_id =
75 search_configuration_t::template exists<search_cfg::output_reference_id>();
77 static constexpr bool output_reference_begin_position =
78 search_configuration_t::template exists<search_cfg::output_reference_begin_position>();
80 static constexpr bool output_index_cursor =
81 search_configuration_t::template exists<search_cfg::output_index_cursor>();
83 static constexpr bool output_requires_locate_call = output_reference_id | output_reference_begin_position;
84
86 static constexpr bool has_output_configuration =
87 output_query_id | output_reference_id | output_reference_begin_position | output_index_cursor;
88
90 static constexpr bool has_user_callback = search_configuration_t::template exists<search_cfg::on_result>();
91};
92
93} // namespace seqan3::detail
Provides various type traits on generic types.
Provides seqan3::detail::empty_type.
Provides the configuration to define the hit strategies "hit_strata", "hit_all", "hit_all_best",...
Provides the configuration for maximum number of errors for all error types.
Provides seqan3::search_cfg::on_result.
Provides seqan3::search_cfg::detail::result_type.
Provides the configuration for the content of the search result.