libboxes
boxes is a set of specialised containers built on top of STL
|
A generic bloom filter implementation. More...
#include <bloom_filter.hpp>
Public Member Functions | |
Bloom (std::size_t m, HashT h) | |
Instantiates a new bloom filter. More... | |
void | insert (const KeyT &key) |
Inserts key into the filter. More... | |
bool | contains (const KeyT &key) const |
Checks if the filter contains the given key. More... | |
std::size_t | capacity () const BOXES_NOTHROW |
Returns number of bits in the filter. More... | |
std::size_t | k () const BOXES_NOTHROW |
Number of hash functions the filter uses. More... | |
std::size_t | size () const BOXES_NOTHROW |
Estimated number of elements in the filter. More... | |
std::size_t | count () const |
Returns number of bits set in the filter's bitmap. More... | |
void | swap (Bloom &other) |
Swaps the contents of this filter with another one. More... | |
void | clear () BOXES_NOTHROW |
Clears filter's bitmap. More... | |
A generic bloom filter implementation.
KeyT | type of keys the filter will store |
HashT | type of the hash family to use see HashFamily64 concept for more details and associated wrappers in hash_utils.hpp . |
Definition at line 34 of file bloom_filter.hpp.
|
inline |
Instantiates a new bloom filter.
m | number of bits in the filter |
h | an instance of the hash family to use |
Definition at line 45 of file bloom_filter.hpp.
|
inline |
Returns number of bits in the filter.
Definition at line 89 of file bloom_filter.hpp.
|
inline |
Clears filter's bitmap.
Definition at line 134 of file bloom_filter.hpp.
|
inline |
Checks if the filter contains the given key.
False positives are possible, but false negatives are not.
key | key to check |
Definition at line 72 of file bloom_filter.hpp.
|
inline |
Returns number of bits set in the filter's bitmap.
Definition at line 113 of file bloom_filter.hpp.
|
inline |
Inserts key into the filter.
key | key to insert |
Definition at line 54 of file bloom_filter.hpp.
|
inline |
Number of hash functions the filter uses.
Definition at line 96 of file bloom_filter.hpp.
|
inline |
Estimated number of elements in the filter.
Definition at line 103 of file bloom_filter.hpp.
|
inline |
Swaps the contents of this filter with another one.
other | filter to swap with |
Definition at line 124 of file bloom_filter.hpp.