lab_bloom
Brilliant Bloom Filters
BF Class Reference

The BF class implements a int --> int hash function bloom filter (In other words, we will only use "hash functions" that work on integers) More...

#include <bloom.h>

Collaboration diagram for BF:
[legend]

Public Member Functions

 BF (uint64_t size, std::vector< hashFunction > hashList)
 Constructor to create an empty bit vector of the appropriate size. More...
 
 BF (const BF &other)
 Copy constructor. More...
 
 ~BF ()
 Destructor; frees anything stored in heap memory by the BF. More...
 
void add (const int &key)
 Inserts a hashable value into the BF The insert should use every hash function in hashList and ignore collisions. More...
 
bool contains (const int &key) const
 Checks if the bloom filter 'contains' the input key The BF is probabilistic so the return value may be inaccurate. More...
 
void bit_union (const BF &other)
 Perform a bitwise union between two bloom filters. More...
 
void intersect (const BF &other)
 Perform a bitwise intersection between two bloom. More...
 

Public Attributes

std::vector< hashFunction > hv
 
std::vector< bool > bv
 

Detailed Description

The BF class implements a int --> int hash function bloom filter (In other words, we will only use "hash functions" that work on integers)

Constructor & Destructor Documentation

◆ BF() [1/2]

BF::BF ( uint64_t  size,
std::vector< hashFunction >  hashList 
)

Constructor to create an empty bit vector of the appropriate size.

The constructor should store the hashList as a vector of hashFunctions for use in other class methods.

Parameters
sizeThe size (in bits) of the bloom filter to create
hashListA vector containing a list of hash functions to use in the BF

◆ BF() [2/2]

BF::BF ( const BF other)

Copy constructor.

Parameters
otherThe BF to copy

◆ ~BF()

BF::~BF ( )

Destructor; frees anything stored in heap memory by the BF.

Member Function Documentation

◆ add()

void BF::add ( const int &  key)

Inserts a hashable value into the BF The insert should use every hash function in hashList and ignore collisions.

Parameters
keyThe key to insert

◆ bit_union()

void BF::bit_union ( const BF other)

Perform a bitwise union between two bloom filters.

BF1.bit_union(BF2) should store the union in BF1

You should assume BF1 and BF2 have the same size and hashes

Parameters
otherThe BF to union

◆ contains()

bool BF::contains ( const int &  key) const

Checks if the bloom filter 'contains' the input key The BF is probabilistic so the return value may be inaccurate.

Parameters
keyThe element to search for
Returns
True if the BF (might) contain the object, False otherwise

◆ intersect()

void BF::intersect ( const BF other)

Perform a bitwise intersection between two bloom.

BF1.intersect(BF2) should store the intersection in BF1

You should assume BF1 and BF2 have the same size and hashes

Parameters
otherThe BF to intersect

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