libBf

libBf is a header-only C++11 library that implements various types of of Bloom filters.

Architecture

libBf implements a variety of different Bloom filters. Each Bloom filter type is based on one or more cores, which is a policy class that captures store, hash, and partition properties.

The Figure below shows the architecture of libBf.

Each Bloom filter implementation in libBf is uses one or more cores. A core
is a policy class that captures the store, hash, and partition properties of
the Bloom filter.

Download

The libBf source code resides at github and ships with a BSD-style licence.

Download
Version: 0.1
Released: May 22, 2011

Usage

For clarity the following discussion assumes that all the libBf classes exist in the global namespace, e.g., by hoisting them via using namespace bf.

Synopsis

Briefly, this is how you get started with libBf:

  1. Define a core type:

    typedef core<
      fixed_width<uint8_t, std::allocator<uint8_t>
    , double_hashing<default_hasher, 42, 4711>
    , no_partitioning
    > my_core;
  2. Define a Bloom filter type:

    typedef basic<my_core> my_bloom_filter;
  3. Instantiate with a core:

    my_bloom_filter bf({ 1 << 10, 5, 4 });
  4. Use:

    bf.add("foo")
    bf.add("foo")
    bf.add('z')
    bf.add(3.14159)
    std::cout << bf.count("foo") << std::endl;  // returns (likely) 2

For a complete documentation of the API, please refer to the Doxygen documentation.