HIBF 1.0.0-rc.1
seqan::hibf::hierarchical_interleaved_bloom_filter::membership_agent_type Class Reference

Public Member Functions

void sort_results ()
 Sorts the results.
 
Lookup
template<std::ranges::forward_range value_range_t>
std::vector< int64_t > const & membership_for (value_range_t &&values, uint16_t const threshold) &noexcept
 Determines set membership for all user bins contained in this index, based on values and the threshold.
 
template<std::ranges::range value_range_t>
std::vector< int64_t > const & membership_for (value_range_t &&values, uint16_t const threshold) &&noexcept=delete
 Determines set membership for all user bins contained in this index, based on values and the threshold.
 

Constructors, destructor and assignment

 membership_agent_type ()=default
 Defaulted.
 
 membership_agent_type (membership_agent_type const &)=default
 Defaulted.
 
membership_agent_typeoperator= (membership_agent_type const &)=default
 Defaulted.
 
 membership_agent_type (membership_agent_type &&)=default
 Defaulted.
 
membership_agent_typeoperator= (membership_agent_type &&)=default
 Defaulted.
 
 ~membership_agent_type ()=default
 Defaulted.
 

Member Function Documentation

◆ membership_for() [1/2]

template<std::ranges::forward_range value_range_t>
std::vector< int64_t > const & seqan::hibf::hierarchical_interleaved_bloom_filter::membership_agent_type::membership_for ( value_range_t && values,
uint16_t const threshold ) &
inlinenoexcept

Determines set membership for all user bins contained in this index, based on values and the threshold.

Parameters
[in]valuesThe values to process; must model std::ranges::forward_range.
[in]thresholdReport a user bin if there are at least this many hits.
Returns
A vector of user bin ids (index values) with successfull set membership query.
Attention
The result of this function must always be bound via reference, e.g. auto &, to prevent copying.
Sequential calls to this function invalidate the previously returned reference.

Each value in values is queried against the index and all hits are accumulated. If the accumulated sum of hits reaches the threshold for a user bin, that user bin (its index value) is returned.

Example

Lets assume that the hibf index is build on 3 user bins (UB_A, UB_B, and UB_C) and the user bins contain the following hash values:

  • 0: UB_A = {4,5,6,11}
  • 1: UB_B = {4,5,11,12}
  • 2: UB_C = {4,5,6,7,9,10}

Then the following query:

auto agent = hibf.membership_agent();
auto result = agent.membership_for(std::vector<size_t>{4,5,6,7}, 3); // result = {0,2}

would return a vector that contains the index values 0 and 2, indicating that UB_A (hits 4,5,6) and UB_C (hits 4,5,6,7) reached the threshold of >= 3 hits. UB_B only counts 2 hits (hits 4,5) and is thus not contained in the list of user bins with a successful query.

Thread safety

Concurrent invocations of this function are not thread safe, please create a seqan::hibf::hierarchical_interleaved_bloom_filter::membership_agent for each thread.

◆ membership_for() [2/2]

template<std::ranges::range value_range_t>
std::vector< int64_t > const & seqan::hibf::hierarchical_interleaved_bloom_filter::membership_agent_type::membership_for ( value_range_t && values,
uint16_t const threshold ) &&
deletenoexcept

Determines set membership for all user bins contained in this index, based on values and the threshold.

Parameters
[in]valuesThe values to process; must model std::ranges::forward_range.
[in]thresholdReport a user bin if there are at least this many hits.
Returns
A vector of user bin ids (index values) with successfull set membership query.
Attention
The result of this function must always be bound via reference, e.g. auto &, to prevent copying.
Sequential calls to this function invalidate the previously returned reference.

Each value in values is queried against the index and all hits are accumulated. If the accumulated sum of hits reaches the threshold for a user bin, that user bin (its index value) is returned.

Example

Lets assume that the hibf index is build on 3 user bins (UB_A, UB_B, and UB_C) and the user bins contain the following hash values:

  • 0: UB_A = {4,5,6,11}
  • 1: UB_B = {4,5,11,12}
  • 2: UB_C = {4,5,6,7,9,10}

Then the following query:

auto agent = hibf.membership_agent();
auto result = agent.membership_for(std::vector<size_t>{4,5,6,7}, 3); // result = {0,2}

would return a vector that contains the index values 0 and 2, indicating that UB_A (hits 4,5,6) and UB_C (hits 4,5,6,7) reached the threshold of >= 3 hits. UB_B only counts 2 hits (hits 4,5) and is thus not contained in the list of user bins with a successful query.

Thread safety

Concurrent invocations of this function are not thread safe, please create a seqan::hibf::hierarchical_interleaved_bloom_filter::membership_agent for each thread.


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