libBf 0.1
|
The basic Bloom filter. More...
#include <bloom_filter_basic.h>
Public Types | |
typedef Core | core_type |
Public Member Functions | |
basic (core_type &&core) | |
Create a basic Bloom filter. | |
template<typename T > | |
void | add (const T &x) |
Add an item to the set. | |
template<typename T > | |
void | remove (const T &x) |
Remove an item from the set. | |
template<typename T > | |
unsigned | count (const T &x) const |
Get the count of an item. | |
void | clear () |
Remove all items from the set. | |
std::string | to_string () const |
Get a string representation of the Bloom filter. | |
unsigned | k () const |
Get the number of hash functions. | |
const core_type & | core () const |
Get the core. | |
Static Public Member Functions | |
static double | k (double f) |
Compute \(k^*\), the optimal number of hash functions for a given false positive rate \(f\). | |
static double | capacity (unsigned k, unsigned m) |
Compute the capacity of a Bloom filter with respect to a given number of hash functions and number of cells in the store. | |
Protected Attributes | |
core_type | core_ |
The basic Bloom filter.
Definition at line 15 of file bloom_filter_basic.h.
Create a basic Bloom filter.
core | An rvalue reference to a core. |
Definition at line 42 of file bloom_filter_basic.h.
void bf::basic< Core >::add | ( | const T & | x | ) | [inline] |
Add an item to the set.
T | The type of the item to insert. |
x | An instance of type T. |
Reimplemented from bf::bloom_filter< basic< Core > >.
Reimplemented in bf::spectral_mi< Core >, and bf::stable< Core, Generator >.
Definition at line 48 of file bloom_filter_basic.h.
static double bf::basic< Core >::capacity | ( | unsigned | k, |
unsigned | m | ||
) | [inline, static] |
Compute the capacity of a Bloom filter with respect to a given number of hash functions and number of cells in the store.
The capacity is defined as the maximum number of items the Bloom filter can hold before the FP rate can no longer be guaranteed.
k | The number of hash functions. |
m | The number of cells in the Bloom filter |
Definition at line 35 of file bloom_filter_basic.h.
unsigned bf::basic< Core >::count | ( | const T & | x | ) | const [inline] |
Get the count of an item.
T | The type of the item to query. |
x | An instance of type T. |
Reimplemented from bf::bloom_filter< basic< Core > >.
Definition at line 60 of file bloom_filter_basic.h.
static double bf::basic< Core >::k | ( | double | f | ) | [inline, static] |
Compute \(k^*\), the optimal number of hash functions for a given false positive rate \(f\).
Definition at line 23 of file bloom_filter_basic.h.
unsigned bf::basic< Core >::k | ( | ) | const [inline] |
Get the number of hash functions.
Definition at line 78 of file bloom_filter_basic.h.
void bf::basic< Core >::remove | ( | const T & | x | ) | [inline] |
Remove an item from the set.
T | The type of the item to delete. |
x | An instance of type T. |
Reimplemented from bf::bloom_filter< basic< Core > >.
Reimplemented in bf::spectral_mi< Core >, and bf::stable< Core, Generator >.
Definition at line 54 of file bloom_filter_basic.h.
std::string bf::basic< Core >::to_string | ( | ) | const [inline] |
Get a string representation of the Bloom filter.
Reimplemented from bf::bloom_filter< basic< Core > >.
Definition at line 71 of file bloom_filter_basic.h.