SeqAn3  3.0.1
The Modern C++ library for sequence analysis.
seqan3::configuration< configs_t > Class Template Reference

Collection of elements to configure an algorithm. More...

#include <seqan3/core/algorithm/configuration.hpp>

+ Inheritance diagram for seqan3::configuration< configs_t >:

Public Member Functions

swap (T... args)
 
Constructor, destructor and assignment
constexpr configuration ()=default
 Defaulted.
 
constexpr configuration (configuration const &)=default
 Defaulted.
 
constexpr configuration (configuration &&)=default
 Defaulted.
 
constexpr configurationoperator= (configuration const &)=default
 Defaulted.
 
constexpr configurationoperator= (configuration &&)=default
 Defaulted.
 
 ~configuration ()=default
 Defaulted.
 
template<typename derived_t , typename value_t >
constexpr configuration (pipeable_config_element< derived_t, value_t > &&elem)
 Constructs a configuration from a single configuration element. More...
 
template<typename derived_t , typename value_t >
constexpr configuration (pipeable_config_element< derived_t, value_t > const &elem)
 Constructs a configuration from a single configuration element. More...
 
Capacity
constexpr size_t size () const noexcept
 Returns the number of contained config elements.
 

Friends

template<detail::config_element ... _configs_t>
class configuration
 Friend declaration for other instances of the configuration.
 
Pipe operator
template<typename lhs_derived_t , typename lhs_value_t , typename rhs_derived_t , typename rhs_value_t >
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. More...
 
template<typename lhs_derived_t , typename lhs_value_t , typename rhs_derived_t , typename rhs_value_t >
constexpr friend auto operator| (pipeable_config_element< lhs_derived_t, lhs_value_t > &&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 only in what argument(s) it accepts.
 
template<typename lhs_derived_t , typename lhs_value_t , typename rhs_derived_t , typename rhs_value_t >
constexpr friend auto operator| (pipeable_config_element< lhs_derived_t, lhs_value_t > 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 only in what argument(s) it accepts.
 
template<typename lhs_derived_t , typename lhs_value_t , typename rhs_derived_t , typename rhs_value_t >
constexpr friend auto operator| (pipeable_config_element< lhs_derived_t, lhs_value_t > 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 only in what argument(s) it accepts.
 
template<typename rhs_derived_t , typename rhs_value_t >
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. More...
 
template<typename rhs_derived_t , typename rhs_value_t >
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 only in what argument(s) it accepts.
 
template<typename rhs_derived_t , typename rhs_value_t >
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 only in what argument(s) it accepts.
 
template<typename rhs_derived_t , typename rhs_value_t >
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 only in what argument(s) it accepts.
 
template<typename ... rhs_configs_t>
constexpr friend auto operator| (configuration &&lhs, configuration< rhs_configs_t... > &&rhs)
 Combines two seqan3::configuration objects. More...
 
template<typename ... rhs_configs_t>
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 only in what argument(s) it accepts.
 
template<typename ... rhs_configs_t>
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 only in what argument(s) it accepts.
 
template<typename ... rhs_configs_t>
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 only in what argument(s) it accepts.
 

Related Functions

(Note that these are not member functions.)

Type deduction guides
template<typename derived_t , typename value_t >
 configuration (pipeable_config_element< derived_t, value_t > &&) -> configuration< remove_cvref_t< derived_t >>
 Deduces the correct configuration element type from the passed seqan3::pipeable_config_element.
 
template<typename derived_t , typename value_t >
 configuration (pipeable_config_element< derived_t, value_t > const &) -> configuration< remove_cvref_t< derived_t >>
 Deduces the correct configuration element type from the passed seqan3::pipeable_config_element.
 
Tuple interface
template<template< typename ... > class query_t, typename ... configs_t>
constexpr auto & get (configuration< configs_t... > &config) noexcept
 Returns the stored element. More...
 

Observers

template<typename query_t , typename default_t >
constexpr decltype(auto) value_or (default_t &&default_value) &noexcept
 Returns the contained value if *this has a value, otherwise returns default_value. More...
 
template<typename query_t , typename default_t >
constexpr decltype(auto) value_or (default_t &&default_value) const &noexcept
 Returns the contained value if *this has a value, otherwise returns default_value. More...
 
template<typename query_t , typename default_t >
constexpr decltype(auto) value_or (default_t &&default_value) &&noexcept
 Returns the contained value if *this has a value, otherwise returns default_value. More...
 
template<typename query_t , typename default_t >
constexpr decltype(auto) value_or (default_t &&default_value) const &&noexcept
 Returns the contained value if *this has a value, otherwise returns default_value. More...
 
template<template< typename ... > typename query_t, typename default_t >
constexpr decltype(auto) value_or (default_t &&default_value) &noexcept
 Returns the contained value if *this has a value, otherwise returns default_value. More...
 
template<template< typename ... > typename query_t, typename default_t >
constexpr decltype(auto) value_or (default_t &&default_value) const &noexcept
 Returns the contained value if *this has a value, otherwise returns default_value. More...
 
template<template< typename ... > typename query_t, typename default_t >
constexpr decltype(auto) value_or (default_t &&default_value) &&noexcept
 Returns the contained value if *this has a value, otherwise returns default_value. More...
 
template<template< typename ... > typename query_t, typename default_t >
constexpr decltype(auto) value_or (default_t &&default_value) const &&noexcept
 Returns the contained value if *this has a value, otherwise returns default_value. More...
 
template<typename query_t >
static constexpr bool exists () noexcept
 Checks if the given type exists in the tuple.
 
template<template< typename ... > typename query_t>
static constexpr bool exists () noexcept
 Checks if the given type exists in the tuple.
 

Detailed Description

template<detail::config_element ... configs_t>
class seqan3::configuration< configs_t >

Collection of elements to configure an algorithm.

Template Parameters
configs_tTemplate parameter pack containing all configuration elements; Must model seqan3::detail::config_element

This class provides a unified interface to create and query such configurations for a specific algorithm. It extends the standard tuple interface with some useful functions to modify and query the user configurations.

Constructor & Destructor Documentation

◆ configuration() [1/2]

template<detail::config_element ... configs_t>
template<typename derived_t , typename value_t >
constexpr seqan3::configuration< configs_t >::configuration ( pipeable_config_element< derived_t, value_t > &&  elem)
inlineconstexpr

Constructs a configuration from a single configuration element.

Parameters
elemThe element to store.

◆ configuration() [2/2]

template<detail::config_element ... configs_t>
template<typename derived_t , typename value_t >
constexpr seqan3::configuration< configs_t >::configuration ( pipeable_config_element< derived_t, value_t > const &  elem)
inlineconstexpr

Constructs a configuration from a single configuration element.

Parameters
elemThe element to store.

Member Function Documentation

◆ value_or() [1/8]

template<detail::config_element ... configs_t>
template<typename query_t , typename default_t >
constexpr decltype(auto) seqan3::configuration< configs_t >::value_or ( default_t &&  default_value) &&
inlineconstexprnoexcept

Returns the contained value if *this has a value, otherwise returns default_value.

Template Parameters
query_tThe type to get the value from.
Parameters
[in]default_valueThe default value if query_t is not contained in the configuration.

Returns a reference to the stored configuration value by passing through the .value member of the respective configuration element. If it does not exists than the default value is returned. The existence check of a type is done at compile time.

Example

// Initial setup used in the actual example:
enum struct my_id : int
{
bar_id,
foo_id
};
struct bar : public seqan3::pipeable_config_element<bar, float>
{
static constexpr my_id id{my_id::bar_id};
};
template <typename t>
struct foo : public seqan3::pipeable_config_element<foo<t>, t>
{
static constexpr my_id id{my_id::foo_id};
};
template <typename t>
foo(t) -> foo<t>;
int main()
{
seqan3::configuration my_cfg{bar{1.3}};
seqan3::debug_stream << my_cfg.value_or<bar>("not there") << '\n'; // prints: 1.3
seqan3::debug_stream << my_cfg.value_or<foo>("not there") << '\n'; // prints: not there
}

Exception

no-throw guarantee.

Complexity

Constant time.

◆ value_or() [2/8]

template<detail::config_element ... configs_t>
template<template< typename ... > typename query_t, typename default_t >
constexpr decltype(auto) seqan3::configuration< configs_t >::value_or ( default_t &&  default_value) &&
inlineconstexprnoexcept

Returns the contained value if *this has a value, otherwise returns default_value.

Template Parameters
query_tThe type to get the value from.
Parameters
[in]default_valueThe default value if query_t is not contained in the configuration.

Returns a reference to the stored configuration value by passing through the .value member of the respective configuration element. If it does not exists than the default value is returned. The existence check of a type is done at compile time.

Example

// Initial setup used in the actual example:
enum struct my_id : int
{
bar_id,
foo_id
};
struct bar : public seqan3::pipeable_config_element<bar, float>
{
static constexpr my_id id{my_id::bar_id};
};
template <typename t>
struct foo : public seqan3::pipeable_config_element<foo<t>, t>
{
static constexpr my_id id{my_id::foo_id};
};
template <typename t>
foo(t) -> foo<t>;
int main()
{
seqan3::configuration my_cfg{bar{1.3}};
seqan3::debug_stream << my_cfg.value_or<bar>("not there") << '\n'; // prints: 1.3
seqan3::debug_stream << my_cfg.value_or<foo>("not there") << '\n'; // prints: not there
}

Exception

no-throw guarantee.

Complexity

Constant time.

◆ value_or() [3/8]

template<detail::config_element ... configs_t>
template<typename query_t , typename default_t >
constexpr decltype(auto) seqan3::configuration< configs_t >::value_or ( default_t &&  default_value) &
inlineconstexprnoexcept

Returns the contained value if *this has a value, otherwise returns default_value.

Template Parameters
query_tThe type to get the value from.
Parameters
[in]default_valueThe default value if query_t is not contained in the configuration.

Returns a reference to the stored configuration value by passing through the .value member of the respective configuration element. If it does not exists than the default value is returned. The existence check of a type is done at compile time.

Example

// Initial setup used in the actual example:
enum struct my_id : int
{
bar_id,
foo_id
};
struct bar : public seqan3::pipeable_config_element<bar, float>
{
static constexpr my_id id{my_id::bar_id};
};
template <typename t>
struct foo : public seqan3::pipeable_config_element<foo<t>, t>
{
static constexpr my_id id{my_id::foo_id};
};
template <typename t>
foo(t) -> foo<t>;
int main()
{
seqan3::configuration my_cfg{bar{1.3}};
seqan3::debug_stream << my_cfg.value_or<bar>("not there") << '\n'; // prints: 1.3
seqan3::debug_stream << my_cfg.value_or<foo>("not there") << '\n'; // prints: not there
}

Exception

no-throw guarantee.

Complexity

Constant time.

◆ value_or() [4/8]

template<detail::config_element ... configs_t>
template<template< typename ... > typename query_t, typename default_t >
constexpr decltype(auto) seqan3::configuration< configs_t >::value_or ( default_t &&  default_value) &
inlineconstexprnoexcept

Returns the contained value if *this has a value, otherwise returns default_value.

Template Parameters
query_tThe type to get the value from.
Parameters
[in]default_valueThe default value if query_t is not contained in the configuration.

Returns a reference to the stored configuration value by passing through the .value member of the respective configuration element. If it does not exists than the default value is returned. The existence check of a type is done at compile time.

Example

// Initial setup used in the actual example:
enum struct my_id : int
{
bar_id,
foo_id
};
struct bar : public seqan3::pipeable_config_element<bar, float>
{
static constexpr my_id id{my_id::bar_id};
};
template <typename t>
struct foo : public seqan3::pipeable_config_element<foo<t>, t>
{
static constexpr my_id id{my_id::foo_id};
};
template <typename t>
foo(t) -> foo<t>;
int main()
{
seqan3::configuration my_cfg{bar{1.3}};
seqan3::debug_stream << my_cfg.value_or<bar>("not there") << '\n'; // prints: 1.3
seqan3::debug_stream << my_cfg.value_or<foo>("not there") << '\n'; // prints: not there
}

Exception

no-throw guarantee.

Complexity

Constant time.

◆ value_or() [5/8]

template<detail::config_element ... configs_t>
template<typename query_t , typename default_t >
constexpr decltype(auto) seqan3::configuration< configs_t >::value_or ( default_t &&  default_value) const &&
inlineconstexprnoexcept

Returns the contained value if *this has a value, otherwise returns default_value.

Template Parameters
query_tThe type to get the value from.
Parameters
[in]default_valueThe default value if query_t is not contained in the configuration.

Returns a reference to the stored configuration value by passing through the .value member of the respective configuration element. If it does not exists than the default value is returned. The existence check of a type is done at compile time.

Example

// Initial setup used in the actual example:
enum struct my_id : int
{
bar_id,
foo_id
};
struct bar : public seqan3::pipeable_config_element<bar, float>
{
static constexpr my_id id{my_id::bar_id};
};
template <typename t>
struct foo : public seqan3::pipeable_config_element<foo<t>, t>
{
static constexpr my_id id{my_id::foo_id};
};
template <typename t>
foo(t) -> foo<t>;
int main()
{
seqan3::configuration my_cfg{bar{1.3}};
seqan3::debug_stream << my_cfg.value_or<bar>("not there") << '\n'; // prints: 1.3
seqan3::debug_stream << my_cfg.value_or<foo>("not there") << '\n'; // prints: not there
}

Exception

no-throw guarantee.

Complexity

Constant time.

◆ value_or() [6/8]

template<detail::config_element ... configs_t>
template<template< typename ... > typename query_t, typename default_t >
constexpr decltype(auto) seqan3::configuration< configs_t >::value_or ( default_t &&  default_value) const &&
inlineconstexprnoexcept

Returns the contained value if *this has a value, otherwise returns default_value.

Template Parameters
query_tThe type to get the value from.
Parameters
[in]default_valueThe default value if query_t is not contained in the configuration.

Returns a reference to the stored configuration value by passing through the .value member of the respective configuration element. If it does not exists than the default value is returned. The existence check of a type is done at compile time.

Example

// Initial setup used in the actual example:
enum struct my_id : int
{
bar_id,
foo_id
};
struct bar : public seqan3::pipeable_config_element<bar, float>
{
static constexpr my_id id{my_id::bar_id};
};
template <typename t>
struct foo : public seqan3::pipeable_config_element<foo<t>, t>
{
static constexpr my_id id{my_id::foo_id};
};
template <typename t>
foo(t) -> foo<t>;
int main()
{
seqan3::configuration my_cfg{bar{1.3}};
seqan3::debug_stream << my_cfg.value_or<bar>("not there") << '\n'; // prints: 1.3
seqan3::debug_stream << my_cfg.value_or<foo>("not there") << '\n'; // prints: not there
}

Exception

no-throw guarantee.

Complexity

Constant time.

◆ value_or() [7/8]

template<detail::config_element ... configs_t>
template<typename query_t , typename default_t >
constexpr decltype(auto) seqan3::configuration< configs_t >::value_or ( default_t &&  default_value) const &
inlineconstexprnoexcept

Returns the contained value if *this has a value, otherwise returns default_value.

Template Parameters
query_tThe type to get the value from.
Parameters
[in]default_valueThe default value if query_t is not contained in the configuration.

Returns a reference to the stored configuration value by passing through the .value member of the respective configuration element. If it does not exists than the default value is returned. The existence check of a type is done at compile time.

Example

// Initial setup used in the actual example:
enum struct my_id : int
{
bar_id,
foo_id
};
struct bar : public seqan3::pipeable_config_element<bar, float>
{
static constexpr my_id id{my_id::bar_id};
};
template <typename t>
struct foo : public seqan3::pipeable_config_element<foo<t>, t>
{
static constexpr my_id id{my_id::foo_id};
};
template <typename t>
foo(t) -> foo<t>;
int main()
{
seqan3::configuration my_cfg{bar{1.3}};
seqan3::debug_stream << my_cfg.value_or<bar>("not there") << '\n'; // prints: 1.3
seqan3::debug_stream << my_cfg.value_or<foo>("not there") << '\n'; // prints: not there
}

Exception

no-throw guarantee.

Complexity

Constant time.

◆ value_or() [8/8]

template<detail::config_element ... configs_t>
template<template< typename ... > typename query_t, typename default_t >
constexpr decltype(auto) seqan3::configuration< configs_t >::value_or ( default_t &&  default_value) const &
inlineconstexprnoexcept

Returns the contained value if *this has a value, otherwise returns default_value.

Template Parameters
query_tThe type to get the value from.
Parameters
[in]default_valueThe default value if query_t is not contained in the configuration.

Returns a reference to the stored configuration value by passing through the .value member of the respective configuration element. If it does not exists than the default value is returned. The existence check of a type is done at compile time.

Example

// Initial setup used in the actual example:
enum struct my_id : int
{
bar_id,
foo_id
};
struct bar : public seqan3::pipeable_config_element<bar, float>
{
static constexpr my_id id{my_id::bar_id};
};
template <typename t>
struct foo : public seqan3::pipeable_config_element<foo<t>, t>
{
static constexpr my_id id{my_id::foo_id};
};
template <typename t>
foo(t) -> foo<t>;
int main()
{
seqan3::configuration my_cfg{bar{1.3}};
seqan3::debug_stream << my_cfg.value_or<bar>("not there") << '\n'; // prints: 1.3
seqan3::debug_stream << my_cfg.value_or<foo>("not there") << '\n'; // prints: not there
}

Exception

no-throw guarantee.

Complexity

Constant time.

Friends And Related Function Documentation

◆ operator| [1/3]

template<detail::config_element ... configs_t>
template<typename ... rhs_configs_t>
constexpr friend auto operator| ( configuration< configs_t > &&  lhs,
configuration< rhs_configs_t... > &&  rhs 
)
friend

Combines two seqan3::configuration objects.

Template Parameters
rhs_configs_tA template parameter pack for the second seqan3::configuration operand.
Parameters
[in]lhsThe left hand operand.
[in]rhsThe right hand operand.
Returns
A new seqan3::configuration as the result of concatenating lhs and rhs.

◆ operator| [2/3]

template<detail::config_element ... configs_t>
template<typename rhs_derived_t , typename rhs_value_t >
constexpr friend auto operator| ( configuration< configs_t > &&  lhs,
pipeable_config_element< rhs_derived_t, rhs_value_t > &&  rhs 
)
friend

Combines a seqan3::configuration with a seqan3::pipeable_config_element.

Template Parameters
rhs_derived_tThe derived type of the right hand side operand.
rhs_value_tThe value type of the right hand side operand.
Parameters
[in]lhsThe left hand operand.
[in]rhsThe right hand operand.
Returns
A new seqan3::configuration adding rhs to the passed lhs object.

◆ operator| [3/3]

template<detail::config_element ... configs_t>
template<typename lhs_derived_t , typename lhs_value_t , typename rhs_derived_t , typename rhs_value_t >
constexpr friend auto operator| ( pipeable_config_element< lhs_derived_t, lhs_value_t > &&  lhs,
pipeable_config_element< rhs_derived_t, rhs_value_t > &&  rhs 
)
friend

Combines two seqan3::pipeable_config_element objects to a seqan3::configuration.

Template Parameters
lhs_derived_tThe derived type of the left hand side operand.
lhs_value_tThe value type of the left hand side operand.
rhs_derived_tThe derived type of the right hand side operand.
rhs_value_tThe value type of the right hand side operand.
Parameters
[in]lhsThe left hand operand.
[in]rhsThe right hand operand.
Returns
A new seqan3::configuration containing lhs and rhs.

The documentation for this class was generated from the following file:
debug_stream.hpp
Provides seqan3::debug_stream and related types.
configuration.hpp
Provides seqan3::detail::configuration and utility functions.
pipeable_config_element.hpp
Provides seqan3::pipeable_config_element.
seqan3::configuration
Collection of elements to configure an algorithm.
Definition: configuration.hpp:81
seqan3::pipeable_config_element
Adds pipe interface to configuration elements.
Definition: pipeable_config_element.hpp:30
seqan3::debug_stream
debug_stream_type debug_stream
A global instance of seqan3::debug_stream_type.
Definition: debug_stream.hpp:39