bloom_parameters( unsigned long long int cnt, double fprate = 0.0001, unsigned long long int seed = 0xA5A5A5A55A5A5A5AULL ): minimum_size(1), maximum_size(std::numeric_limits<unsigned long long int>::max()), minimum_number_of_hashes(1), maximum_number_of_hashes(std::numeric_limits<unsigned int>::max() ) { projected_element_count = cnt ; false_positive_probability = fprate ; random_seed = seed ; compute_optimal_parameters() ; }
/* create a bloom filter according to the estimated number of inserted elements and desired false positive probability. It will calculate the optimal value of the table size. */ bloom_filter(const large_integer projected_element_count,double false_positive_probability) { inserted_element_count_ = 0; hash_count_ = 0; table_size_ = 0; raw_table_size_ = 0; compute_optimal_parameters(projected_element_count,false_positive_probability); //hash_range_ = (integer)(ceil(log(table_size_))); raw_table_size_ = table_size_ / bits_per_char; bit_table_ = new bitmap[static_cast<std::size_t>(raw_table_size_)]; std::fill_n(bit_table_,raw_table_size_,0x00); //hash_ = new HashFunc[hash_count_]; // allocate memory hash_ = static_cast<HashFunc*>(::operator new(sizeof(HashFunc) * hash_count_)); generate_independent_hashes(); }