24 namespace seqan3::detail
30 struct search_configuration_validator
44 template <
typename configuration_t>
45 static void validate_error_configuration(configuration_t
const & cfg)
47 static_assert(detail::is_type_specialisation_of_v<configuration_t, configuration>,
48 "cfg must be a specialisation of seqan3::configuration.");
50 using search_traits_t = detail::search_traits<configuration_t>;
52 if constexpr (search_traits_t::search_with_max_error)
54 auto const & [total, subs, ins, del] = get<search_cfg::max_error>(cfg).value;
59 throw std::invalid_argument{
"The insertion error threshold is higher than the total error threshold."};
61 throw std::invalid_argument{
"The deletion error threshold is higher than the total error threshold."};
63 else if constexpr (search_traits_t::search_with_max_error_rate)
65 auto const & [total, subs, ins, del] = get<search_cfg::max_error_rate>(cfg).value;
70 throw std::invalid_argument{
"The insertion error threshold is higher than the total error threshold."};
72 throw std::invalid_argument{
"The deletion error threshold is higher than the total error threshold."};
80 template <
typename query_t>
81 static void validate_query_type()
83 using pure_query_t = remove_cvref_t<query_t>;
84 if constexpr(dimension_v<pure_query_t> == 1u)
86 static_assert(std::ranges::random_access_range<pure_query_t>,
87 "The query sequence must model random_access_range.");
88 static_assert(std::ranges::sized_range<pure_query_t>,
"The query sequence must model sized_range.");
92 static_assert(std::ranges::forward_range<pure_query_t>,
"The query collection must model forward_range.");
93 static_assert(std::ranges::sized_range<pure_query_t>,
"The query collection must model sized_range.");
94 static_assert(std::ranges::random_access_range<std::ranges::range_value_t<pure_query_t>>,
95 "Elements of the query collection must model random_access_range.");
96 static_assert(std::ranges::sized_range<std::ranges::range_value_t<pure_query_t>>,
97 "Elements of the query collection must model sized_range.");
166 template <fm_index_specialisation index_t,
typename queries_t,
typename configuration_t = decltype(search_cfg::default_configuration)>
168 index_t
const & index,
171 using search_traits_t = detail::search_traits<configuration_t>;
174 if constexpr (!search_traits_t::has_mode_configuration)
180 if constexpr (!search_traits_t::has_output_configuration)
186 detail::search_configuration_validator::validate_query_type<queries_t>();
187 detail::search_configuration_validator::validate_error_configuration(cfg);
189 return detail::search_all(index, std::forward<queries_t>(queries), cfg);
196 template <fm_index_specialisation index_t,
typename configuration_t = decltype(search_cfg::default_configuration)>
197 inline auto search(
char const *
const queries,
198 index_t
const & index,
205 template <fm_index_specialisation index_t,
typename configuration_t = decltype(search_cfg::default_configuration)>
207 index_t
const & index,