JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
bloom_filter.hpp
Go to the documentation of this file.
1 /*
2  *********************************************************************
3  * *
4  * Open Bloom Filter *
5  * *
6  * Author: Arash Partow - 2000 *
7  * URL: http://www.partow.net *
8  * URL: http://www.partow.net/programming/hashfunctions/index.html *
9  * *
10  * Copyright notice: *
11  * Free use of the Open Bloom Filter Library is permitted under the *
12  * guidelines and in accordance with the MIT License. *
13  * http://www.opensource.org/licenses/MIT *
14  * *
15  *********************************************************************
16 */
17 
18 
19 #ifndef INCLUDE_BLOOM_FILTER_HPP
20 #define INCLUDE_BLOOM_FILTER_HPP
21 
22 #include <algorithm>
23 #include <cmath>
24 #include <cstddef>
25 #include <cstdlib>
26 #include <iterator>
27 #include <limits>
28 #include <string>
29 #include <vector>
30 
31 static const std::size_t bits_per_char = 0x08; // 8 bits in 1 char(unsigned)
32 
33 static const unsigned char bit_mask[bits_per_char] = {
34  0x01, //00000001
35  0x02, //00000010
36  0x04, //00000100
37  0x08, //00001000
38  0x10, //00010000
39  0x20, //00100000
40  0x40, //01000000
41  0x80 //10000000
42 };
43 
45  public:
46 
48  : minimum_size(1),
49  maximum_size(std::numeric_limits<unsigned long long int>::max()),
51  maximum_number_of_hashes(std::numeric_limits<unsigned int>::max()),
54  random_seed(0xA5A5A5A55A5A5A5AULL) {}
55 
56  virtual ~bloom_parameters() {}
57 
58  inline bool operator!() {
59  return (minimum_size > maximum_size) ||
62  (0 == maximum_number_of_hashes) ||
63  (0 == projected_element_count) ||
65  (std::numeric_limits<double>::infinity() == std::abs(false_positive_probability)) ||
66  (0 == random_seed) ||
67  (0xFFFFFFFFFFFFFFFFULL == random_seed);
68  }
69 
70  // Allowable min/max size of the bloom filter in bits
71  unsigned long long int minimum_size;
72  unsigned long long int maximum_size;
73 
74  // Allowable min/max number of hash functions
77 
78  // The approximate number of elements to be inserted
79  // into the bloom filter, should be within one order
80  // of magnitude. The default is 10000.
81  unsigned long long int projected_element_count;
82 
83  // The approximate false positive probability expected
84  // from the bloom filter. The default is assumed to be
85  // the reciprocal of the projected_element_count.
87 
88  unsigned long long int random_seed;
89 
92  : number_of_hashes(0),
93  table_size(0) {}
94 
95  unsigned int number_of_hashes;
96  unsigned long long int table_size;
97  };
98 
100 
101  virtual bool compute_optimal_parameters() {
102  /*
103  Note:
104  The following will attempt to find the number of hash functions
105  and minimum amount of storage bits required to construct a bloom
106  filter consistent with the user defined false positive probability
107  and estimated element insertion count.
108  */
109 
110  if (!(*this))
111  return false;
112 
113  double min_m = std::numeric_limits<double>::infinity();
114  double min_k = 0.0;
115  double k = 1.0;
116 
117  while (k < 1000.0) {
118  const double numerator = (-k * projected_element_count);
119  const double denominator = std::log(1.0 - std::pow(false_positive_probability, 1.0 / k));
120 
121  const double curr_m = numerator / denominator;
122 
123  if (curr_m < min_m) {
124  min_m = curr_m;
125  min_k = k;
126  }
127 
128  k += 1.0;
129  }
130 
132 
133  optp.number_of_hashes = static_cast<unsigned int>(min_k);
134 
135  optp.table_size = static_cast<unsigned long long int>(min_m);
136 
137  optp.table_size +=
138  (((optp.table_size % bits_per_char) != 0) ? (bits_per_char - (optp.table_size % bits_per_char)) : 0);
139 
144 
145  if (optp.table_size < minimum_size)
146  optp.table_size = minimum_size;
147  else if (optp.table_size > maximum_size)
148  optp.table_size = maximum_size;
149 
150  return true;
151  }
152 
153 };
154 
156  protected:
157 
158  typedef unsigned int bloom_type;
159  typedef unsigned char cell_type;
160  typedef std::vector<unsigned char> table_type;
161 
162  public:
163 
165  : salt_count_(0),
166  table_size_(0),
169  random_seed_(0),
171 
173  : projected_element_count_(p.projected_element_count),
175  random_seed_((p.random_seed * 0xA5A5A5A5) + 1),
176  desired_false_positive_probability_(p.false_positive_probability) {
179 
181 
182  bit_table_.resize(table_size_ / bits_per_char, static_cast<unsigned char>(0x00));
183  }
184 
185  bloom_filter(const bloom_filter &filter) {
186  this->operator=(filter);
187  }
188 
189  inline bool operator==(const bloom_filter &f) const {
190  if (this != &f) {
191  return
192  (salt_count_ == f.salt_count_) &&
193  (table_size_ == f.table_size_) &&
194  (bit_table_.size() == f.bit_table_.size()) &&
197  (random_seed_ == f.random_seed_) &&
199  (salt_ == f.salt_) &&
200  (bit_table_ == f.bit_table_);
201  } else
202  return true;
203  }
204 
205  inline bool operator!=(const bloom_filter &f) const {
206  return !operator==(f);
207  }
208 
209  inline bloom_filter &operator=(const bloom_filter &f) {
210  if (this != &f) {
214  salt_ = f.salt_;
215 
218 
220 
222  }
223 
224  return *this;
225  }
226 
227  virtual ~bloom_filter() {}
228 
229  inline bool operator!() const {
230  return (0 == table_size_);
231  }
232 
233  inline void clear() {
234  std::fill(bit_table_.begin(), bit_table_.end(), static_cast<unsigned char>(0x00));
236  }
237 
238  inline void insert(const unsigned char *key_begin, const std::size_t &length) {
239  std::size_t bit_index = 0;
240  std::size_t bit = 0;
241 
242  for (std::size_t i = 0; i < salt_.size(); ++i) {
243  compute_indices(hash_ap(key_begin, length, salt_[i]), bit_index, bit);
244 
245  bit_table_[bit_index / bits_per_char] |= bit_mask[bit];
246  }
247 
249  }
250 
251  template<typename T>
252  inline void insert(const T &t) {
253  // Note: T must be a C++ POD type.
254  insert(reinterpret_cast<const unsigned char *>(&t), sizeof(T));
255  }
256 
257  inline void insert(const std::string &key) {
258  insert(reinterpret_cast<const unsigned char *>(key.data()), key.size());
259  }
260 
261  inline void insert(const char *data, const std::size_t &length) {
262  insert(reinterpret_cast<const unsigned char *>(data), length);
263  }
264 
265  template<typename InputIterator>
266  inline void insert(const InputIterator begin, const InputIterator end) {
267  InputIterator itr = begin;
268 
269  while (end != itr) {
270  insert(*(itr++));
271  }
272  }
273 
274  inline virtual bool contains(const unsigned char *key_begin, const std::size_t length) const {
275  std::size_t bit_index = 0;
276  std::size_t bit = 0;
277 
278  for (std::size_t i = 0; i < salt_.size(); ++i) {
279  compute_indices(hash_ap(key_begin, length, salt_[i]), bit_index, bit);
280 
281  if ((bit_table_[bit_index / bits_per_char] & bit_mask[bit]) != bit_mask[bit]) {
282  return false;
283  }
284  }
285 
286  return true;
287  }
288 
289  template<typename T>
290  inline bool contains(const T &t) const {
291  return contains(reinterpret_cast<const unsigned char *>(&t), static_cast<std::size_t>(sizeof(T)));
292  }
293 
294  inline bool contains(const std::string &key) const {
295  return contains(reinterpret_cast<const unsigned char *>(key.c_str()), key.size());
296  }
297 
298  inline bool contains(const char *data, const std::size_t &length) const {
299  return contains(reinterpret_cast<const unsigned char *>(data), length);
300  }
301 
302  template<typename InputIterator>
303  inline InputIterator contains_all(const InputIterator begin, const InputIterator end) const {
304  InputIterator itr = begin;
305 
306  while (end != itr) {
307  if (!contains(*itr)) {
308  return itr;
309  }
310 
311  ++itr;
312  }
313 
314  return end;
315  }
316 
317  template<typename InputIterator>
318  inline InputIterator contains_none(const InputIterator begin, const InputIterator end) const {
319  InputIterator itr = begin;
320 
321  while (end != itr) {
322  if (contains(*itr)) {
323  return itr;
324  }
325 
326  ++itr;
327  }
328 
329  return end;
330  }
331 
332  inline virtual unsigned long long int size() const {
333  return table_size_;
334  }
335 
336  inline unsigned long long int element_count() const {
338  }
339 
340  inline double effective_fpp() const {
341  /*
342  Note:
343  The effective false positive probability is calculated using the
344  designated table size and hash function count in conjunction with
345  the current number of inserted elements - not the user defined
346  predicated/expected number of inserted elements.
347  */
348  return std::pow(1.0 - std::exp(-1.0 * salt_.size() * inserted_element_count_ / size()), 1.0 * salt_.size());
349  }
350 
352  /* intersection */
353  if (
354  (salt_count_ == f.salt_count_) &&
355  (table_size_ == f.table_size_) &&
357  ) {
358  for (std::size_t i = 0; i < bit_table_.size(); ++i) {
359  bit_table_[i] &= f.bit_table_[i];
360  }
361  }
362 
363  return *this;
364  }
365 
367  /* union */
368  if (
369  (salt_count_ == f.salt_count_) &&
370  (table_size_ == f.table_size_) &&
372  ) {
373  for (std::size_t i = 0; i < bit_table_.size(); ++i) {
374  bit_table_[i] |= f.bit_table_[i];
375  }
376  }
377 
378  return *this;
379  }
380 
382  /* difference */
383  if (
384  (salt_count_ == f.salt_count_) &&
385  (table_size_ == f.table_size_) &&
387  ) {
388  for (std::size_t i = 0; i < bit_table_.size(); ++i) {
389  bit_table_[i] ^= f.bit_table_[i];
390  }
391  }
392 
393  return *this;
394  }
395 
396  inline const cell_type *table() const {
397  return bit_table_.data();
398  }
399 
400  inline std::size_t hash_count() {
401  return salt_.size();
402  }
403 
404  protected:
405 
406  inline virtual void compute_indices(const bloom_type &hash, std::size_t &bit_index, std::size_t &bit) const {
407  bit_index = hash % table_size_;
408  bit = bit_index % bits_per_char;
409  }
410 
412  /*
413  Note:
414  A distinct hash function need not be implementation-wise
415  distinct. In the current implementation "seeding" a common
416  hash function with different values seems to be adequate.
417  */
418  const unsigned int predef_salt_count = 128;
419 
420  static const bloom_type predef_salt[predef_salt_count] =
421  {
422  0xAAAAAAAA, 0x55555555, 0x33333333, 0xCCCCCCCC,
423  0x66666666, 0x99999999, 0xB5B5B5B5, 0x4B4B4B4B,
424  0xAA55AA55, 0x55335533, 0x33CC33CC, 0xCC66CC66,
425  0x66996699, 0x99B599B5, 0xB54BB54B, 0x4BAA4BAA,
426  0xAA33AA33, 0x55CC55CC, 0x33663366, 0xCC99CC99,
427  0x66B566B5, 0x994B994B, 0xB5AAB5AA, 0xAAAAAA33,
428  0x555555CC, 0x33333366, 0xCCCCCC99, 0x666666B5,
429  0x9999994B, 0xB5B5B5AA, 0xFFFFFFFF, 0xFFFF0000,
430  0xB823D5EB, 0xC1191CDF, 0xF623AEB3, 0xDB58499F,
431  0xC8D42E70, 0xB173F616, 0xA91A5967, 0xDA427D63,
432  0xB1E8A2EA, 0xF6C0D155, 0x4909FEA3, 0xA68CC6A7,
433  0xC395E782, 0xA26057EB, 0x0CD5DA28, 0x467C5492,
434  0xF15E6982, 0x61C6FAD3, 0x9615E352, 0x6E9E355A,
435  0x689B563E, 0x0C9831A8, 0x6753C18B, 0xA622689B,
436  0x8CA63C47, 0x42CC2884, 0x8E89919B, 0x6EDBD7D3,
437  0x15B6796C, 0x1D6FDFE4, 0x63FF9092, 0xE7401432,
438  0xEFFE9412, 0xAEAEDF79, 0x9F245A31, 0x83C136FC,
439  0xC3DA4A8C, 0xA5112C8C, 0x5271F491, 0x9A948DAB,
440  0xCEE59A8D, 0xB5F525AB, 0x59D13217, 0x24E7C331,
441  0x697C2103, 0x84B0A460, 0x86156DA9, 0xAEF2AC68,
442  0x23243DA5, 0x3F649643, 0x5FA495A8, 0x67710DF8,
443  0x9A6C499E, 0xDCFB0227, 0x46A43433, 0x1832B07A,
444  0xC46AFF3C, 0xB9C8FFF0, 0xC9500467, 0x34431BDF,
445  0xB652432B, 0xE367F12B, 0x427F4C1B, 0x224C006E,
446  0x2E7E5A89, 0x96F99AA5, 0x0BEB452A, 0x2FD87C39,
447  0x74B2E1FB, 0x222EFD24, 0xF357F60C, 0x440FCB1E,
448  0x8BBE030F, 0x6704DC29, 0x1144D12F, 0x948B1355,
449  0x6D8FD7E9, 0x1C11A014, 0xADD1592F, 0xFB3C712E,
450  0xFC77642F, 0xF9C4CE8C, 0x31312FB9, 0x08B0DD79,
451  0x318FA6E7, 0xC040D23D, 0xC0589AA7, 0x0CA5C075,
452  0xF874B172, 0x0CF914D5, 0x784D3280, 0x4E8CFEBC,
453  0xC569F575, 0xCDB2A091, 0x2CC016B4, 0x5C5F4421
454  };
455 
456  if (salt_count_ <= predef_salt_count) {
457  std::copy(predef_salt,
458  predef_salt + salt_count_,
459  std::back_inserter(salt_));
460 
461  for (std::size_t i = 0; i < salt_.size(); ++i) {
462  /*
463  Note:
464  This is done to integrate the user defined random seed,
465  so as to allow for the generation of unique bloom filter
466  instances.
467  */
468  salt_[i] = salt_[i] * salt_[(i + 3) % salt_.size()] + static_cast<bloom_type>(random_seed_);
469  }
470  } else {
471  std::copy(predef_salt, predef_salt + predef_salt_count, std::back_inserter(salt_));
472 
473  srand(static_cast<unsigned int>(random_seed_));
474 
475  while (salt_.size() < salt_count_) {
476  bloom_type current_salt = static_cast<bloom_type>(rand()) * static_cast<bloom_type>(rand());
477 
478  if (0 == current_salt)
479  continue;
480 
481  if (salt_.end() == std::find(salt_.begin(), salt_.end(), current_salt)) {
482  salt_.push_back(current_salt);
483  }
484  }
485  }
486  }
487 
488  inline bloom_type hash_ap(const unsigned char *begin, std::size_t remaining_length, bloom_type hash) const {
489  const unsigned char *itr = begin;
490  unsigned int loop = 0;
491 
492  while (remaining_length >= 8) {
493  const unsigned int &i1 = *(reinterpret_cast<const unsigned int *>(itr));
494  itr += sizeof(unsigned int);
495  const unsigned int &i2 = *(reinterpret_cast<const unsigned int *>(itr));
496  itr += sizeof(unsigned int);
497 
498  hash ^= (hash << 7) ^ i1 * (hash >> 3) ^
499  (~((hash << 11) + (i2 ^ (hash >> 5))));
500 
501  remaining_length -= 8;
502  }
503 
504  if (remaining_length) {
505  if (remaining_length >= 4) {
506  const unsigned int &i = *(reinterpret_cast<const unsigned int *>(itr));
507 
508  if (loop & 0x01)
509  hash ^= (hash << 7) ^ i * (hash >> 3);
510  else
511  hash ^= (~((hash << 11) + (i ^ (hash >> 5))));
512 
513  ++loop;
514 
515  remaining_length -= 4;
516 
517  itr += sizeof(unsigned int);
518  }
519 
520  if (remaining_length >= 2) {
521  const unsigned short &i = *(reinterpret_cast<const unsigned short *>(itr));
522 
523  if (loop & 0x01)
524  hash ^= (hash << 7) ^ i * (hash >> 3);
525  else
526  hash ^= (~((hash << 11) + (i ^ (hash >> 5))));
527 
528  ++loop;
529 
530  remaining_length -= 2;
531 
532  itr += sizeof(unsigned short);
533  }
534 
535  if (remaining_length) {
536  hash += ((*itr) ^ (hash * 0xA5A5A5A5)) + loop;
537  }
538  }
539 
540  return hash;
541  }
542 
543  std::vector<bloom_type> salt_;
544  std::vector<unsigned char> bit_table_;
545  unsigned int salt_count_;
546  unsigned long long int table_size_;
547  unsigned long long int projected_element_count_;
548  unsigned long long int inserted_element_count_;
549  unsigned long long int random_seed_;
551 };
552 
553 inline bloom_filter operator&(const bloom_filter &a, const bloom_filter &b) {
554  bloom_filter result = a;
555  result &= b;
556  return result;
557 }
558 
559 inline bloom_filter operator|(const bloom_filter &a, const bloom_filter &b) {
560  bloom_filter result = a;
561  result |= b;
562  return result;
563 }
564 
565 inline bloom_filter operator^(const bloom_filter &a, const bloom_filter &b) {
566  bloom_filter result = a;
567  result ^= b;
568  return result;
569 }
570 
572  public:
573 
575  : bloom_filter(p) {
576  size_list.push_back(table_size_);
577  }
578 
579  inline unsigned long long int size() const {
580  return size_list.back();
581  }
582 
583  inline bool compress(const double &percentage) {
584  if (
585  (percentage < 0.0) ||
586  (percentage >= 100.0)
587  ) {
588  return false;
589  }
590 
591  unsigned long long int original_table_size = size_list.back();
592  unsigned long long int
593  new_table_size = static_cast<unsigned long long int>((size_list.back() * (1.0 - (percentage / 100.0))));
594 
595  new_table_size -= new_table_size % bits_per_char;
596 
597  if (
598  (bits_per_char > new_table_size) ||
599  (new_table_size >= original_table_size)
600  ) {
601  return false;
602  }
603 
605 
606  const unsigned long long int new_tbl_raw_size = new_table_size / bits_per_char;
607 
608  table_type tmp(new_tbl_raw_size);
609 
610  std::copy(bit_table_.begin(), bit_table_.begin() + new_tbl_raw_size, tmp.begin());
611 
612  typedef table_type::iterator itr_t;
613 
614  itr_t itr = bit_table_.begin() + (new_table_size / bits_per_char);
615  itr_t end = bit_table_.begin() + (original_table_size / bits_per_char);
616  itr_t itr_tmp = tmp.begin();
617 
618  while (end != itr) {
619  *(itr_tmp++) |= (*itr++);
620  }
621 
622  std::swap(bit_table_, tmp);
623 
624  size_list.push_back(new_table_size);
625 
626  return true;
627  }
628 
629  private:
630 
631  inline void compute_indices(const bloom_type &hash, std::size_t &bit_index, std::size_t &bit) const {
632  bit_index = hash;
633 
634  for (std::size_t i = 0; i < size_list.size(); ++i) {
635  bit_index %= size_list[i];
636  }
637 
638  bit = bit_index % bits_per_char;
639  }
640 
641  std::vector<unsigned long long int> size_list;
642 };
643 
644 #endif
645 
646 
647 /*
648  Note 1:
649  If it can be guaranteed that bits_per_char will be of the form 2^n then
650  the following optimization can be used:
651 
652  bit_table_[bit_index >> n] |= bit_mask[bit_index & (bits_per_char - 1)];
653 
654  Note 2:
655  For performance reasons where possible when allocating memory it should
656  be aligned (aligned_alloc) according to the architecture being used.
657 */
bloom_filter operator|(const bloom_filter &a, const bloom_filter &b)
Definition: bloom_filter.hpp:559
bloom_filter operator^(const bloom_filter &a, const bloom_filter &b)
Definition: bloom_filter.hpp:565
bloom_filter operator&(const bloom_filter &a, const bloom_filter &b)
Definition: bloom_filter.hpp:553
static const unsigned char bit_mask[bits_per_char]
Definition: bloom_filter.hpp:33
static const std::size_t bits_per_char
Definition: bloom_filter.hpp:31
Definition: bloom_filter.hpp:155
InputIterator contains_all(const InputIterator begin, const InputIterator end) const
Definition: bloom_filter.hpp:303
bloom_filter & operator&=(const bloom_filter &f)
Definition: bloom_filter.hpp:351
double desired_false_positive_probability_
Definition: bloom_filter.hpp:550
unsigned long long int projected_element_count_
Definition: bloom_filter.hpp:547
bloom_filter(const bloom_filter &filter)
Definition: bloom_filter.hpp:185
bool contains(const std::string &key) const
Definition: bloom_filter.hpp:294
unsigned long long int table_size_
Definition: bloom_filter.hpp:546
unsigned long long int element_count() const
Definition: bloom_filter.hpp:336
bool operator!=(const bloom_filter &f) const
Definition: bloom_filter.hpp:205
void insert(const unsigned char *key_begin, const std::size_t &length)
Definition: bloom_filter.hpp:238
void generate_unique_salt()
Definition: bloom_filter.hpp:411
bloom_filter()
Definition: bloom_filter.hpp:164
bool contains(const T &t) const
Definition: bloom_filter.hpp:290
std::size_t hash_count()
Definition: bloom_filter.hpp:400
bool contains(const char *data, const std::size_t &length) const
Definition: bloom_filter.hpp:298
void insert(const T &t)
Definition: bloom_filter.hpp:252
std::vector< unsigned char > table_type
Definition: bloom_filter.hpp:160
InputIterator contains_none(const InputIterator begin, const InputIterator end) const
Definition: bloom_filter.hpp:318
std::vector< bloom_type > salt_
Definition: bloom_filter.hpp:543
void insert(const std::string &key)
Definition: bloom_filter.hpp:257
unsigned long long int random_seed_
Definition: bloom_filter.hpp:549
virtual bool contains(const unsigned char *key_begin, const std::size_t length) const
Definition: bloom_filter.hpp:274
bloom_filter & operator^=(const bloom_filter &f)
Definition: bloom_filter.hpp:381
bool operator!() const
Definition: bloom_filter.hpp:229
std::vector< unsigned char > bit_table_
Definition: bloom_filter.hpp:544
void insert(const InputIterator begin, const InputIterator end)
Definition: bloom_filter.hpp:266
bool operator==(const bloom_filter &f) const
Definition: bloom_filter.hpp:189
bloom_filter & operator=(const bloom_filter &f)
Definition: bloom_filter.hpp:209
unsigned long long int inserted_element_count_
Definition: bloom_filter.hpp:548
virtual unsigned long long int size() const
Definition: bloom_filter.hpp:332
bloom_filter & operator|=(const bloom_filter &f)
Definition: bloom_filter.hpp:366
const cell_type * table() const
Definition: bloom_filter.hpp:396
virtual void compute_indices(const bloom_type &hash, std::size_t &bit_index, std::size_t &bit) const
Definition: bloom_filter.hpp:406
bloom_type hash_ap(const unsigned char *begin, std::size_t remaining_length, bloom_type hash) const
Definition: bloom_filter.hpp:488
double effective_fpp() const
Definition: bloom_filter.hpp:340
bloom_filter(const bloom_parameters &p)
Definition: bloom_filter.hpp:172
void clear()
Definition: bloom_filter.hpp:233
unsigned char cell_type
Definition: bloom_filter.hpp:159
unsigned int bloom_type
Definition: bloom_filter.hpp:158
virtual ~bloom_filter()
Definition: bloom_filter.hpp:227
void insert(const char *data, const std::size_t &length)
Definition: bloom_filter.hpp:261
unsigned int salt_count_
Definition: bloom_filter.hpp:545
Definition: bloom_filter.hpp:44
bloom_parameters()
Definition: bloom_filter.hpp:47
double false_positive_probability
Definition: bloom_filter.hpp:86
unsigned long long int maximum_size
Definition: bloom_filter.hpp:72
unsigned int maximum_number_of_hashes
Definition: bloom_filter.hpp:76
unsigned long long int projected_element_count
Definition: bloom_filter.hpp:81
virtual ~bloom_parameters()
Definition: bloom_filter.hpp:56
bool operator!()
Definition: bloom_filter.hpp:58
virtual bool compute_optimal_parameters()
Definition: bloom_filter.hpp:101
unsigned long long int random_seed
Definition: bloom_filter.hpp:88
unsigned long long int minimum_size
Definition: bloom_filter.hpp:71
unsigned int minimum_number_of_hashes
Definition: bloom_filter.hpp:75
optimal_parameters_t optimal_parameters
Definition: bloom_filter.hpp:99
Definition: bloom_filter.hpp:571
compressible_bloom_filter(const bloom_parameters &p)
Definition: bloom_filter.hpp:574
unsigned long long int size() const
Definition: bloom_filter.hpp:579
bool compress(const double &percentage)
Definition: bloom_filter.hpp:583
void swap(BlockingConcurrentQueue< T, Traits > &a, BlockingConcurrentQueue< T, Traits > &b) MOODYCAMEL_NOEXCEPT
Definition: blockingconcurrentqueue.h:929
Definition: bloom_filter.hpp:90
unsigned int number_of_hashes
Definition: bloom_filter.hpp:95
unsigned long long int table_size
Definition: bloom_filter.hpp:96
optimal_parameters_t()
Definition: bloom_filter.hpp:91