sdbf  3.3
 All Classes Functions Variables Friends
Public Member Functions
bloom_filter Class Reference

bloom_filter class More...

#include <bloom_filter.h>

List of all members.

Public Member Functions

 bloom_filter (uint64_t size, uint16_t hash_count, uint64_t max_elem, double max_fp)
 base constructor
 bloom_filter (string indexfilename)
 construct from file - not add to master or fold up.
 bloom_filter (uint8_t *data, uint64_t size, int id, int bf_elem_ct, uint16_t hamming)
 construct bloom filter from buffer
 ~bloom_filter ()
bool insert_sha1 (uint32_t *sha1)
 insert SHA1 hash
bool query_sha1 (uint32_t *sha1)
 query SHA1 hash
uint64_t elem_count ()
 return element count
double est_fp_rate ()
 return estimate of false positive rate
double bits_per_elem ()
 return bits per element
string name () const
 name associated with bloom filter
void set_name (string name)
 change name associated with bloom filter
void fold (uint32_t times)
 fold a large bloom filter onto itself
int add (bloom_filter *other)
 add another same-sized bloom filter to this one
int write_out (string filename)
 write bloom filter to .idx file
int bloom_id ()
 id associated with bloom filter (used for grouping)

Detailed Description

bloom_filter: a Bloom filter class.

Constructor & Destructor Documentation

bloom_filter::bloom_filter ( uint64_t  size,
uint16_t  hash_count,
uint64_t  max_elem,
double  max_fp 

Create new empty bloom filter

sizeof bloom filter
hash_countnumber of hashes for each insertion or query
max_elemmax element size (0 ok)
max_fpmax false positive rate (0 ok)
bloom_filter::bloom_filter ( string  indexfilename)

Read bloom filter from a file

indexfilenamefile to read
bloom_filter::bloom_filter ( uint8_t *  data,
uint64_t  size,
int  id,
int  bf_elem_ct,
uint16_t  hamming 

Creates bloom filter from existing buffer of bloom filter data. Experimental: sized for sdbf 256-byte bloom filters at the moment

databuffer of bloom filter data
sizeof bloom filter data
ididentifier for clustering bloom filters
bf_elem_ct# of elements in filter
hammingweight of filter

Destroys bloom filter and frees buffer

Member Function Documentation

int bloom_filter::add ( bloom_filter other)

Adds another bloom filter to this one

otherbloom filter
0 if successful 1 if not the same size

Returns bits per element in bloom filter


Returns number of elements present in bloom filter

number of elements

Returns estimated false positive rate (not implemented)

void bloom_filter::fold ( uint32_t  times)

Folds bloom filter by half N times by or'ing the second half of the bloom filter onto the first half.

timesamount of times to fold filter
bool bloom_filter::insert_sha1 ( uint32_t *  sha1)

Inserts hash data into this bloom filter

sha1buffer of sha1 hash values
exists or not exists
string bloom_filter::name ( ) const

Returns name associated with bloom filter

bool bloom_filter::query_sha1 ( uint32_t *  sha1)

Queries this bloom filter with hash data

sha1buffer of sha1 hash values
exists or not exists
void bloom_filter::set_name ( string  name)

Changes name associated with bloom filter

namenew name
int32_t bloom_filter::write_out ( string  filename)

Writes bloom filter out to a file.

filenamefile to be written
status -1 if compression fails, -2 if cannot open file

The documentation for this class was generated from the following files: