Embedded Template Library 1.0
|
Classes | |
class | etl::bloom_filter< Desired_Width, THash1, THash2, THash3 > |
A Bloom filter
class etl::bloom_filter |
An implementation of a bloom filter. Allows up to three hashes to be defined. Hashes must support the () operator and define 'argument_type'.
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. | |
|
inline |
Adds a key to the filter.
key | The key to add. |
|
inline |
Tests a key to see if it exists in the filter.
key | The key to test. |