Loading...
Searching...
No Matches
seqan3::search_cfg::on_result< callback_t > Class Template Reference
Search » Configuration

Configuration element to provide a user defined callback function for the search. More...

`#include <seqan3/search/configuration/on_result.hpp>`

Inheritance diagram for seqan3::search_cfg::on_result< callback_t >:
[legend]

## Public Member Functions

Constructors, destructor and assignment
constexpr | on_result ()=default
| Defaulted.
constexpr | on_result (on_result const &)=default
| Defaulted.
constexpr | on_result (on_result &&)=default
| Defaulted.
constexpr on_result & | operator= (on_result const &)=default
| Defaulted.
constexpr on_result & | operator= (on_result &&)=default
| Defaulted.
| ~on_result ()=default
| Defaulted.
constexpr | on_result (callback_t &&callback)
| Constructs the configuration element with the given user callback.

## Public Attributes

seqan::stl::detail::movable_box_t< callback_t > | callback
| The stored callable which will be invoked with the search result.

## Detailed Description

template<std::move_constructible callback_t>
class seqan3::search_cfg::on_result< callback_t >

Configuration element to provide a user defined callback function for the search.

See also
  Configuration

Template Parameters

  callback_t | The type of the callback; must model std::invocable with the generated seqan3::search_result and std::move_constructible.

Allows the user to specify a callback that should be called for every computed search result. The callback must take exactly one argument for the search result and return void. If the user callback is specified, the call to the search algorithm seqan3::search will return nothing, i.e. it does not return a seqan3::algorithm_result_generator_range any more. Note that within a parallel configuration, the order of the generated search results and therefore the call to the user callback is non-deterministic. However, the continuation interface with the user callback can be more efficient in a concurrent environment.

### Example

The following code snippet demonstrates the basic usage:

// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: CC0-1.0
#include <seqan3/core/debug_stream.hpp>
#include <seqan3/search/configuration/on_result.hpp>
int main()
{
seqan3::search_cfg::on_result cfg{[](auto && result)
{
seqan3::debug_stream << result << '\n';
}};
return 0;
}
seqan3::search_cfg::on_result
Configuration element to provide a user defined callback function for the search.
Definition on_result.hpp:52
debug_stream.hpp
Provides seqan3::debug_stream and related types.
seqan3::debug_stream
debug_stream_type debug_stream
A global instance of seqan3::debug_stream_type.
Definition debug_stream.hpp:38
on_result.hpp
Provides seqan3::search_cfg::on_result.

## Constructor & Destructor Documentation

## on_result()

template<std::move_constructible callback_t>

seqan3::search_cfg::on_result< callback_t >::on_result | ( | callback_t && | callback | ) |

inline explicit constexpr

Constructs the configuration element with the given user callback.

Parameters

  [in] | callback | The callback to invoke with a computed seqan3::search_result.

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

- on_result.hpp

Hide me