|
lab_bloom
Brilliant Bloom Filters
|
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>
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 |
The BF class implements a int --> int hash function bloom filter (In other words, we will only use "hash functions" that work on integers)
| 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.
| size | The size (in bits) of the bloom filter to create |
| hashList | A vector containing a list of hash functions to use in the BF |
| BF::~BF | ( | ) |
Destructor; frees anything stored in heap memory by the BF.
| 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.
| key | The key to insert |
| 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
| other | The BF to union |
| bool BF::contains | ( | const int & | key | ) | const |
| 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
| other | The BF to intersect |