 |
SeqAn3
3.0.1
The Modern C++ library for sequence analysis.
|
|
Go to the documentation of this file.
17 #include <meta/meta.hpp>
32 template <detail::config_element ... configs_t>
35 template <
typename lhs_derived_t,
typename lhs_value_t,
typename rhs_derived_t,
typename rhs_value_t>
36 constexpr
auto operator|(pipeable_config_element<lhs_derived_t, lhs_value_t> && lhs,
37 pipeable_config_element<rhs_derived_t, rhs_value_t> && rhs)
39 return configuration{
static_cast<lhs_derived_t &&
>(lhs)}.push_back(
static_cast<rhs_derived_t &&
>(rhs));
42 template <
typename lhs_derived_t,
typename lhs_value_t,
typename rhs_derived_t,
typename rhs_value_t>
43 constexpr
auto operator|(pipeable_config_element<lhs_derived_t, lhs_value_t> && lhs,
44 pipeable_config_element<rhs_derived_t, rhs_value_t>
const & rhs)
46 return configuration{
static_cast<lhs_derived_t &&
>(lhs)}.push_back(
static_cast<rhs_derived_t
const &
>(rhs));
49 template <
typename lhs_derived_t,
typename lhs_value_t,
typename rhs_derived_t,
typename rhs_value_t>
50 constexpr
auto operator|(pipeable_config_element<lhs_derived_t, lhs_value_t>
const & lhs,
51 pipeable_config_element<rhs_derived_t, rhs_value_t> && rhs)
53 return configuration{
static_cast<lhs_derived_t
const &
>(lhs)}.push_back(
static_cast<rhs_derived_t &&
>(rhs));
56 template <
typename lhs_derived_t,
typename lhs_value_t,
typename rhs_derived_t,
typename rhs_value_t>
57 constexpr
auto operator|(pipeable_config_element<lhs_derived_t, lhs_value_t>
const & lhs,
58 pipeable_config_element<rhs_derived_t, rhs_value_t>
const & rhs)
60 return configuration{
static_cast<lhs_derived_t
const &
>(lhs)}.push_back(
static_cast<rhs_derived_t
const &
>(rhs));
80 template <detail::config_element ... configs_t>
84 template <detail::config_element ... _configs_t>
105 template <
typename derived_t,
typename value_t>
113 template <
typename derived_t,
typename value_t>
115 base_type{
static_cast<derived_t
const &
>(elem)}
123 constexpr
size_t size() const noexcept
126 return std::tuple_size_v<base_type>;
155 template <
typename query_t,
typename default_t>
156 constexpr decltype(
auto)
value_or(default_t && default_value) & noexcept
158 if constexpr (exists<query_t>())
160 return get<query_t>(*this).value;
165 return static_cast<ret_type
>(default_value);
170 template <
typename query_t,
typename default_t>
171 constexpr decltype(
auto)
value_or(default_t && default_value) const & noexcept
173 if constexpr (exists<query_t>())
175 return get<query_t>(*this).value;
180 return static_cast<ret_type
>(default_value);
185 template <
typename query_t,
typename default_t>
186 constexpr decltype(
auto)
value_or(default_t && default_value) && noexcept
188 if constexpr (exists<query_t>())
190 return get<query_t>(
std::move(*
this)).value;
195 return static_cast<ret_type
>(default_value);
200 template <
typename query_t,
typename default_t>
201 constexpr decltype(
auto)
value_or(default_t && default_value) const && noexcept
203 if constexpr (exists<query_t>())
205 return get<query_t>(
std::move(*
this)).value;
210 return static_cast<ret_type
>(default_value);
215 template <
template <
typename ...>
typename query_t,
typename default_t>
216 constexpr decltype(
auto)
value_or(default_t && default_value) & noexcept
218 if constexpr (exists<query_t>())
220 return get<query_t>(*this).value;
225 return static_cast<ret_type
>(default_value);
230 template <
template <
typename ...>
typename query_t,
typename default_t>
231 constexpr decltype(
auto)
value_or(default_t && default_value) const & noexcept
233 if constexpr (exists<query_t>())
235 return get<query_t>(*this).value;
240 return static_cast<ret_type
>(default_value);
245 template <
template <
typename ...>
typename query_t,
typename default_t>
246 constexpr decltype(
auto)
value_or(default_t && default_value) && noexcept
248 if constexpr (exists<query_t>())
250 return get<query_t>(
std::move(*
this)).value;
255 return static_cast<ret_type
>(default_value);
260 template <
template <
typename ...>
typename query_t,
typename default_t>
261 constexpr decltype(
auto)
value_or(default_t && default_value) const && noexcept
263 if constexpr (exists<query_t>())
265 return get<query_t>(
std::move(*
this)).value;
270 return static_cast<ret_type
>(default_value);
275 template <
typename query_t>
281 template <
template <
typename ...>
typename query_t>
284 return (
pack_traits::find_if<detail::is_same_configuration_f<query_t>::template invoke, configs_t...> > -1);
300 template <
typename lhs_derived_t,
typename lhs_value_t,
typename rhs_derived_t,
typename rhs_value_t>
305 template <
typename lhs_derived_t,
typename lhs_value_t,
typename rhs_derived_t,
typename rhs_value_t>
310 template <
typename lhs_derived_t,
typename lhs_value_t,
typename rhs_derived_t,
typename rhs_value_t>
315 template <
typename lhs_derived_t,
typename lhs_value_t,
typename rhs_derived_t,
typename rhs_value_t>
326 template <
typename rhs_derived_t,
typename rhs_value_t>
330 return std::move(lhs).push_back(
static_cast<rhs_derived_t &&
>(rhs));
334 template <
typename rhs_derived_t,
typename rhs_value_t>
338 return lhs.push_back(
static_cast<rhs_derived_t &&
>(rhs));
342 template <
typename rhs_derived_t,
typename rhs_value_t>
346 return std::move(lhs).push_back(
static_cast<rhs_derived_t
const &
>(rhs));
350 template <
typename rhs_derived_t,
typename rhs_value_t>
354 return lhs.push_back(
static_cast<rhs_derived_t
const &
>(rhs));
363 template <
typename ...rhs_configs_t>
371 static_cast<rhs_base_t
>(
std::move(rhs))));
375 template <
typename ...rhs_configs_t>
382 return make_configuration(
std::tuple_cat(
static_cast<lhs_base_t
>(lhs),
383 static_cast<rhs_base_t
>(
std::move(rhs))));
387 template <
typename ...rhs_configs_t>
395 static_cast<rhs_base_t
>(rhs)));
399 template <
typename ...rhs_configs_t>
406 return make_configuration(
std::tuple_cat(
static_cast<lhs_base_t
>(lhs),
407 static_cast<rhs_base_t
>(rhs)));
416 template <
typename ..._configs_t>
422 template <
typename ..._configs_t>
433 template <
typename tuple_t>
435 requires detail::is_type_specialisation_of_v<tuple_t, std::tuple> &&
436 std::tuple_size_v<remove_cvref_t<tuple_t>> > 0
438 static constexpr
auto make_configuration(tuple_t && tpl)
440 auto make_config = [](
auto && tpl)
442 auto impl = [](
auto & impl_ref,
auto && config,
auto && head,
auto && tail)
446 return std::forward<decltype(config)>(config).push_back(std::get<0>(
std::forward<decltype(head)>(head)));
450 auto [_head, _tail] = tuple_split<1>(
std::forward<decltype(tail)>(tail));
451 auto tmp = std::forward<decltype(config)>(config).push_back(
456 auto [head, tail] = tuple_split<1>(
std::forward<decltype(tpl)>(tpl));
459 return make_config(std::forward<tuple_t>(tpl));
488 template <detail::config_element config_element_t>
489 constexpr
auto push_back(config_element_t elem)
const &
491 static_assert(detail::is_configuration_valid_v<remove_cvref_t<config_element_t>,
493 "Configuration error: The passed element cannot be combined with one or more elements in the "
494 "current configuration.");
502 template <detail::config_element config_element_t>
503 constexpr
auto push_back(config_element_t elem) &&
505 static_assert(detail::is_configuration_valid_v<remove_cvref_t<config_element_t>,
507 "Configuration error: The passed element cannot be combined with one or more elements in the "
508 "current configuration.");
524 template <
typename derived_t,
typename value_t>
525 configuration(pipeable_config_element<derived_t, value_t> &&) -> configuration<remove_cvref_t<derived_t>>;
530 template <
typename derived_t,
typename value_t>
531 configuration(pipeable_config_element<derived_t, value_t>
const &) -> configuration<remove_cvref_t<derived_t>>;
565 template <
template <
typename ...>
class query_t,
typename ...configs_t>
568 constexpr
auto pos = pack_traits::find_if<detail::is_same_configuration_f<query_t>::template invoke, configs_t...>;
569 static_assert(pos > -1,
"Access error: The requested type is not contained.");
571 return get<pos>(config);
575 template <
template <
typename ...>
class query_t,
typename ...configs_t>
578 constexpr
auto pos = pack_traits::find_if<detail::is_same_configuration_f<query_t>::template invoke, configs_t...>;
579 static_assert(pos > -1,
"Access error: The requested type is not contained.");
581 return get<pos>(config);
585 template <
template <
typename ...>
class query_t,
typename ...configs_t>
588 constexpr
auto pos = pack_traits::find_if<detail::is_same_configuration_f<query_t>::template invoke, configs_t...>;
589 static_assert(pos > -1,
"Access error: The requested type is not contained.");
595 template <
template <
typename ...>
class query_t,
typename ...configs_t>
598 constexpr
auto pos = pack_traits::find_if<detail::is_same_configuration_f<query_t>::template invoke, configs_t...>;
599 static_assert(pos > -1,
"Access error: The requested type is not contained.");
618 template <seqan3::detail::config_element ... configs_t>
619 struct tuple_size<
seqan3::configuration<configs_t...>>
630 template <
size_t pos, seqan3::detail::config_element ... configs_t>
631 struct tuple_element<pos,
seqan3::configuration<configs_t...>>
std::remove_cv_t< std::remove_reference_t< t > > remove_cvref_t
Return the input type with const, volatile and references removed (type trait).
Definition: basic.hpp:35
constexpr configuration(pipeable_config_element< derived_t, value_t > const &elem)
Constructs a configuration from a single configuration element.
Definition: configuration.hpp:114
constexpr friend auto operator|(configuration const &lhs, pipeable_config_element< rhs_derived_t, rhs_value_t > &&rhs)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: configuration.hpp:335
const auto move
A view that turns lvalue-references into rvalue-references.
Definition: move.hpp:68
Provides seqan3::pipeable_config_element.
static constexpr bool exists() noexcept
Checks if the given type exists in the tuple.
Definition: configuration.hpp:276
constexpr friend auto operator|(configuration &&lhs, pipeable_config_element< rhs_derived_t, rhs_value_t > const &rhs)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: configuration.hpp:343
constexpr bool contains
Whether a type occurs in a pack or not.
Definition: traits.hpp:193
auto operator|(validator1_type &&vali1, validator2_type &&vali2)
Enables the chaining of validators.
Definition: validators.hpp:1023
Provides concepts for the configuration classes.
Collection of elements to configure an algorithm.
Definition: configuration.hpp:81
Provides utility functions for tuple like interfaces.
friend class configuration
Friend declaration for other instances of the configuration.
Definition: configuration.hpp:85
constexpr size_t size() const noexcept
Returns the number of contained config elements.
Definition: configuration.hpp:124
constexpr friend auto operator|(configuration &&lhs, pipeable_config_element< rhs_derived_t, rhs_value_t > &&rhs)
Combines a seqan3::configuration with a seqan3::pipeable_config_element.
Definition: configuration.hpp:327
typename remove_rvalue_reference< t >::type remove_rvalue_reference_t
Return the input type with && removed, but lvalue references preserved (transformation_trait shortcut...
Definition: basic.hpp:58
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:36
constexpr ptrdiff_t find_if
Get the index of the first type in a pack that satisfies the given predicate.
Definition: traits.hpp:175
Adds pipe interface to configuration elements.
Definition: pipeable_config_element.hpp:30
constexpr decltype(auto) value_or(default_t &&default_value) &noexcept
Returns the contained value if *this has a value, otherwise returns default_value.
Definition: configuration.hpp:156
constexpr friend auto operator|(configuration &&lhs, configuration< rhs_configs_t... > const &rhs)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: configuration.hpp:388
constexpr friend auto operator|(configuration &&lhs, configuration< rhs_configs_t... > &&rhs)
Combines two seqan3::configuration objects.
Definition: configuration.hpp:364
~configuration()=default
Defaulted.
constexpr configuration & operator=(configuration const &)=default
Defaulted.
constexpr friend auto operator|(configuration const &lhs, configuration< rhs_configs_t... > const &rhs)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: configuration.hpp:400
constexpr friend auto operator|(pipeable_config_element< lhs_derived_t, lhs_value_t > &&lhs, pipeable_config_element< rhs_derived_t, rhs_value_t > &&rhs)
Combines two seqan3::pipeable_config_element objects to a seqan3::configuration.
Provides functionality to access get function by enum values.
SeqAn specific customisations in the standard namespace.
constexpr auto & get(configuration< configs_t... > &config) noexcept
Returns the stored element.
Definition: configuration.hpp:566
Provides traits for seqan3::type_list.
constexpr friend auto operator|(configuration const &lhs, pipeable_config_element< rhs_derived_t, rhs_value_t > const &rhs)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: configuration.hpp:351
constexpr const auto & get(configuration< configs_t... > const &config) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: configuration.hpp:576
constexpr friend auto operator|(configuration const &lhs, configuration< rhs_configs_t... > &&rhs)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: configuration.hpp:376
constexpr configuration(pipeable_config_element< derived_t, value_t > &&elem)
Constructs a configuration from a single configuration element.
Definition: configuration.hpp:106
Provides seqan3::type_list.