btllib
|
#include <counting_bloom_filter.hpp>
Public Member Functions | |
CountingBloomFilter () | |
CountingBloomFilter (size_t bytes, unsigned hash_num, std::string hash_fn="") | |
CountingBloomFilter (const std::string &path) | |
CountingBloomFilter (const CountingBloomFilter &)=delete | |
CountingBloomFilter (CountingBloomFilter &&)=delete | |
CountingBloomFilter & | operator= (const CountingBloomFilter &)=delete |
CountingBloomFilter & | operator= (CountingBloomFilter &&)=delete |
void | insert (const uint64_t *hashes, T n=1) |
void | insert (const std::vector< uint64_t > &hashes, T n=1) |
void | remove (const uint64_t *hashes) |
void | remove (const std::vector< uint64_t > &hashes) |
void | clear (const uint64_t *hashes) |
void | clear (const std::vector< uint64_t > &hashes) |
T | contains (const uint64_t *hashes) const |
T | contains (const std::vector< uint64_t > &hashes) const |
T | contains_insert (const uint64_t *hashes, T n=1) |
T | contains_insert (const std::vector< uint64_t > &hashes, T n=1) |
T | insert_contains (const uint64_t *hashes, T n=1) |
T | insert_contains (const std::vector< uint64_t > &hashes, T n=1) |
T | insert_thresh_contains (const uint64_t *hashes, T threshold) |
T | insert_thresh_contains (const std::vector< uint64_t > &hashes, const T threshold) |
T | contains_insert_thresh (const uint64_t *hashes, T threshold) |
T | contains_insert_thresh (const std::vector< uint64_t > &hashes, const T threshold) |
size_t | get_bytes () const |
uint64_t | get_pop_cnt (T threshold=1) const |
double | get_occupancy (T threshold=1) const |
unsigned | get_hash_num () const |
double | get_fpr (T threshold=1) const |
const std::string & | get_hash_fn () const |
void | save (const std::string &path) |
Static Public Member Functions | |
static bool | is_bloom_file (const std::string &path) |
Friends | |
class | KmerCountingBloomFilter< T > |
Counting Bloom filter data structure. Provides CountingBloomFilter8, CountingBloomFilter16, and CountingBloomFilter32 classes with corresponding bit-size counters.
|
inline |
Construct a dummy k-mer Bloom filter (e.g. as a default argument).
|
inline |
Construct an empty Counting Bloom filter of given size.
bytes | Filter size in bytes. |
hash_num | Number of hash values per element. |
hash_fn | Name of the hash function used. Used for metadata. Optional. |
|
inlineexplicit |
Load a Counting Bloom filter from a file.
path | Filepath to load from. |
|
inline |
Set the count of an element to zero.
hashes | Integer vector of the element's hash values. |
void btllib::CountingBloomFilter< T >::clear | ( | const uint64_t * | hashes | ) |
Set the count of an element to zero.
hashes | Integer array of the element's hash values. Array size should equal the hash_num argument used when the Bloom filter was constructed. |
|
inline |
Get the count of an element.
hashes | Integer vector of the element's hash values. |
|
inline |
Get the count of an element.
hashes | Integer array of the element's hash values. Array size should equal the hash_num argument used when the Bloom filter was constructed. |
|
inline |
Get the count of an element and then increment the count.
hashes | Integer vector of the element's hash values. |
n | Increment value |
|
inline |
Get the count of an element and then increment the count.
hashes | Integer array of the element's hash values. Array size should equal the hash_num argument used when the Bloom filter was constructed. |
n | Increment value |
|
inline |
Get the count of an element and then increment the count if it's not above the threshold.
hashes | Integer vector of the element's hash values. |
threshold | The threshold. |
|
inline |
Get the count of an element and then increment the count if it's not above the threshold.
hashes | Integer array of the element's hash values. Array size should equal the hash_num argument used when the Bloom filter was constructed. |
threshold | The threshold. |
|
inline |
Get filter size in bytes.
|
inline |
Get the query false positive rate for elements with count >= threshold.
threshold | The threshold. |
|
inline |
Get the name of the hash function used.
|
inline |
Get the number of hash values per element.
|
inline |
Get the fraction of the filter occupied by >= threshold counters.
|
inline |
Get population count, i.e. the number of counters >= threshold in the filter.
|
inline |
Insert an element.
hashes | Integer vector of the element's hash values. |
n | Increment value |
|
inline |
Insert an element.
hashes | Integer array of the element's hash values. Array size should equal the hash_num argument used when the Bloom filter was constructed. |
n | Increment value |
|
inline |
Increment an element's count and then return the count.
hashes | Integer vector of the element's hash values. |
n | Increment value |
|
inline |
Increment an element's count and then return the count.
hashes | Integer array of the element's hash values. Array size should equal the hash_num argument used when the Bloom filter was constructed. |
n | Increment value |
|
inline |
Increment an element's count if it's not above the threshold and then return the count.
hashes | Integer array of the element's hash values. Array size should equal the hash_num argument used when the Bloom filter was constructed. |
threshold | The threshold. |
|
inline |
Increment an element's count if it's not above the threshold and then return the count.
hashes | Integer array of the element's hash values. Array size should equal the hash_num argument used when the Bloom filter was constructed. |
threshold | The threshold. |
|
inlinestatic |
Check whether the file at the given path is a saved Counting Bloom filter.
path | Filepath to check. |
|
inline |
Delete an element.
hashes | Integer vector of the element's hash values. |
|
inline |
Delete an element.
hashes | Integer array of the element's hash values. Array size should equal the hash_num argument used when the Bloom filter was constructed. |
|
inline |
Save the Bloom filter to a file that can be loaded in the future.
path | Filepath to store filter at. |