libBf 0.1
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes

bf::basic< Core > Class Template Reference

The basic Bloom filter. More...

#include <bloom_filter_basic.h>

Inheritance diagram for bf::basic< Core >:
Inheritance graph
[legend]

List of all members.

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_

Detailed Description

template<typename Core = core<>>
class bf::basic< Core >

The basic Bloom filter.

Definition at line 15 of file bloom_filter_basic.h.


Constructor & Destructor Documentation

template<typename Core = core<>>
bf::basic< Core >::basic ( core_type &&  core) [inline]

Create a basic Bloom filter.

Parameters:
coreAn rvalue reference to a core.

Definition at line 42 of file bloom_filter_basic.h.


Member Function Documentation

template<typename Core = core<>>
template<typename T >
void bf::basic< Core >::add ( const T &  x) [inline]

Add an item to the set.

Template Parameters:
TThe type of the item to insert.
Parameters:
xAn 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.

template<typename Core = core<>>
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.

Parameters:
kThe number of hash functions.
mThe number of cells in the Bloom filter
Returns:
The maximum number of items the Bloom filter can hold.

Definition at line 35 of file bloom_filter_basic.h.

template<typename Core = core<>>
const core_type& bf::basic< Core >::core ( ) const [inline]

Get the core.

Returns:
A reference to the core.

Definition at line 85 of file bloom_filter_basic.h.

template<typename Core = core<>>
template<typename T >
unsigned bf::basic< Core >::count ( const T &  x) const [inline]

Get the count of an item.

Template Parameters:
TThe type of the item to query.
Parameters:
xAn instance of type T.
Returns:
A frequency estimate for x.

Reimplemented from bf::bloom_filter< basic< Core > >.

Definition at line 60 of file bloom_filter_basic.h.

template<typename Core = core<>>
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\).

Returns:
The optimal number of hash functions.

Definition at line 23 of file bloom_filter_basic.h.

template<typename Core = core<>>
unsigned bf::basic< Core >::k ( ) const [inline]

Get the number of hash functions.

Returns:
The number of hash functions.

Definition at line 78 of file bloom_filter_basic.h.

template<typename Core = core<>>
template<typename T >
void bf::basic< Core >::remove ( const T &  x) [inline]

Remove an item from the set.

Template Parameters:
TThe type of the item to delete.
Parameters:
xAn 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.

template<typename Core = core<>>
std::string bf::basic< Core >::to_string ( ) const [inline]

Get a string representation of the Bloom filter.

Returns:
A string representing of the Bloom filter.

Reimplemented from bf::bloom_filter< basic< Core > >.

Definition at line 71 of file bloom_filter_basic.h.


The documentation for this class was generated from the following file:
 All Classes Functions Variables