Loading...
Searching...
No Matches
bloom_filter

## Classes

class | etl::bloom_filter< Desired_Width, THash1, THash2, THash3 >

## Detailed Description

A Bloom filter

## Class Documentation

## etl::bloom_filter

class etl::bloom_filter

template<size_t Desired_Width, typename THash1, typename THash2 = private_bloom_filter::null_hash, typename THash3 = private_bloom_filter::null_hash>
class etl::bloom_filter< Desired_Width, THash1, THash2, THash3 >

An implementation of a bloom filter. Allows up to three hashes to be defined. Hashes must support the () operator and define 'argument_type'.

Template Parameters

  Desired_Width | The desired number of hash results that can be stored. Rounded up to best fit the underlying bitset.
  THash1 | The first hash generator class.
  THash2 | The second hash generator class. If omitted, uses the null hash.
  THash3 | The third hash generator class. If omitted, uses the null hash. The hash classes must define argument_type.

### Public Types

enum | { WIDTH = etl::bitset<Desired_Width>::Allocated_Bits }

### Public Member Functions

void | clear ()
| Clears the bloom filter of all entries.
void | add (parameter_t key)
bool | exists (parameter_t key) const
size_t | width () const
| Returns the width of the Bloom filter.
size_t | usage () const
| Returns the percentage of usage. Range 0 to 100.
size_t | count () const
| Returns the number of filter flags set.

#### Member Function Documentation

## add()

template<size_t Desired_Width, typename THash1, typename THash2 = private_bloom_filter::null_hash, typename THash3 = private_bloom_filter::null_hash>

void etl::bloom_filter< Desired_Width, THash1, THash2, THash3 >::add | ( | parameter_t | key | ) |

inline

Adds a key to the filter.

Parameters

  key | The key to add.

## exists()

template<size_t Desired_Width, typename THash1, typename THash2 = private_bloom_filter::null_hash, typename THash3 = private_bloom_filter::null_hash>

bool etl::bloom_filter< Desired_Width, THash1, THash2, THash3 >::exists | ( | parameter_t | key | ) | const

inline

Tests a key to see if it exists in the filter.

Parameters

  key | The key to test.

Returns
  true if the key exists in the filter.