SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
seqan3::detail::search_configurator Class Reference

Class used to update the search configuration, e.g. add defaults. More...

#include <seqan3/search/detail/search_configurator.hpp>

Classes

struct  select_search_algorithm
 Selects the search algorithm based on the index type. More...
 
struct  select_search_result
 Select the search result based on the configuration and the index type. More...
 

Static Public Member Functions

template<typename configuration_t >
static auto add_default_hit_configuration (configuration_t const &cfg)
 Add seqan3::search_cfg::hit_all to the configuration if no search strategy (hit configuration) was chosen.
 
template<typename configuration_t >
static auto add_default_output_configuration (configuration_t const &cfg)
 Add seqan3::search_cfg::text_position to the configuration if seqan3::search_cfg::output was not set.
 
template<typename configuration_t >
static auto add_defaults (configuration_t const &cfg)
 Adds default configurations if they were not set by the user.
 
template<typename query_t , typename configuration_t , typename index_t >
static auto configure_algorithm (configuration_t const &cfg, index_t const &index)
 Chooses the appropriate search algorithm depending on the index.
 
template<typename algorithm_t , typename configuration_t , typename index_t >
static algorithm_t configure_hit_strategy (configuration_t const &, index_t const &)
 Configures the algorithm with the correct hit strategy.
 
template<typename algorithm_t , typename configuration_t , typename index_t >
static algorithm_t select_and_return_algorithm (configuration_t const &config, index_t const &index)
 Select and return the configured search algorithm.
 

Detailed Description

Class used to update the search configuration, e.g. add defaults.

Member Function Documentation

◆ add_default_hit_configuration()

template<typename configuration_t >
static auto seqan3::detail::search_configurator::add_default_hit_configuration ( configuration_t const &  cfg)
inlinestatic

Add seqan3::search_cfg::hit_all to the configuration if no search strategy (hit configuration) was chosen.

Template Parameters
configuration_tThe type of the search configuration.
Parameters
[in]cfgThe configuration to be modified if necessary.
Returns
The configuration which is guaranteed to have a hit configuration element available.

If no hit configuration was set, it defaults to seqan3::search_cfg::hit_all.

◆ add_default_output_configuration()

template<typename configuration_t >
static auto seqan3::detail::search_configurator::add_default_output_configuration ( configuration_t const &  cfg)
inlinestatic

Add seqan3::search_cfg::text_position to the configuration if seqan3::search_cfg::output was not set.

Template Parameters
configuration_tThe type of the search configuration.
Parameters
[in]cfgThe configuration to be modified if necessary.
Returns
The configuration which is guaranteed to have a seqan3::search_cfg::output available.

If seqan3::search_cfg::output was not set, it defaults to seqan3::search_cfg::text_position.

◆ add_defaults()

template<typename configuration_t >
static auto seqan3::detail::search_configurator::add_defaults ( configuration_t const &  cfg)
inlinestatic

Adds default configurations if they were not set by the user.

Template Parameters
configuration_tThe type of the search configuration.
Parameters
[in]cfgThe configuration to be modified.
Returns
The modified configuration.

Modifies the configuration object by adding default configuration elements.

See also
seqan3::details::search_configurator::add_default_hit_configuration
seqan3::details::search_configurator::add_default_output_configuration

◆ configure_algorithm()

template<typename query_t , typename configuration_t , typename index_t >
static auto seqan3::detail::search_configurator::configure_algorithm ( configuration_t const &  cfg,
index_t const &  index 
)
inlinestatic

Chooses the appropriate search algorithm depending on the index.

Template Parameters
query_tAn explicit template argument for the query type the search algorithm is invoked with.
configuration_tThe type of the search configuration.
index_tThe type of the index.
Parameters
[in]cfgThe search configuration object that is passed to the algorithm.
[in]indexThe index that is passed to the algorithm.
Returns
A search algorithm.

If the cursor of index_t models seqan3::detail::template_specialisation_of a seqan3::bi_fm_index_cursor, then the seqan3::detail::search_scheme_algorithm is chosen. Otherwise, the seqan3::detail::unidirectional_search_algorithm is chosen.

◆ configure_hit_strategy()

template<typename algorithm_t , typename configuration_t , typename index_t >
algorithm_t seqan3::detail::search_configurator::configure_hit_strategy ( configuration_t const &  cfg,
index_t const &  index 
)
static

Configures the algorithm with the correct hit strategy.

Template Parameters
algorithm_tThe type erased algorithm used for the fixed return type.
configuration_tThe type of the search configuration.
index_tThe type of the index.
Returns
The configured search algorithm.

If the algorithm was configured with the dynamic hit configuration element seqan3::search_cfg::hit, the configuration element is removed and replaced by the selected static hit configuration element. If the hit configuration element is already a static one nothing is changed in the configuration. After selecting the correct hit strategy the corresponding search algorithm is created with the new configuration and the given index.

Exceptions
std::invalid_argumentif the dynamic hit configuration was not initialised with a hit strategy.

If no hit configuration was configured a static assert is emitted during compilation.

◆ select_and_return_algorithm()

template<typename algorithm_t , typename configuration_t , typename index_t >
static algorithm_t seqan3::detail::search_configurator::select_and_return_algorithm ( configuration_t const &  config,
index_t const &  index 
)
inlinestatic

Select and return the configured search algorithm.

Template Parameters
algorithm_tThe type erased algorithm used for the fixed return type.
configuration_tThe type of the search configuration.
index_tThe type of the index.
Parameters
[in]configThe search configuration object that is passed to the algorithm.
[in]indexThe index that is passed to the algorithm.

The final step of the configuration pipeline. Here the final algorithm is created and returned as the type erased std::function object. This step must be called at the end.


The documentation for this class was generated from the following file:
Hide me