46 #ifndef PSYNC_BLOOM_FILTER_HPP 47 #define PSYNC_BLOOM_FILTER_HPP 49 #include <ndn-cxx/name.hpp> 75 compute_optimal_parameters();
79 return (minimum_size > maximum_size) ||
80 (minimum_number_of_hashes > maximum_number_of_hashes) ||
81 (minimum_number_of_hashes < 1) ||
82 (0 == maximum_number_of_hashes) ||
83 (0 == projected_element_count) ||
84 (false_positive_probability < 0.0) ||
85 (std::numeric_limits<double>::infinity() == std::abs(false_positive_probability)) ||
87 (0xFFFFFFFFFFFFFFFFULL == random_seed);
105 typedef std::vector <cell_type>::iterator
Iterator;
108 class Error :
public std::runtime_error
111 using std::runtime_error::runtime_error;
119 double false_positive_probability);
122 double false_positive_probability,
123 const ndn::name::Component& bfName);
126 getParameters(
unsigned int projected_element_count,
127 double false_positive_probability);
138 appendToName(ndn::Name& name)
const;
144 insert(
const std::string& key);
147 contains(
const std::string& key)
const;
149 std::vector<cell_type>
154 generate_unique_salt();
157 compute_indices(
const bloom_type& hash,
158 std::size_t& bit_index, std::size_t& bit)
const;
161 std::vector <bloom_type> salt_;
162 std::vector <cell_type> bit_table_;
163 unsigned int salt_count_;
164 unsigned int table_size_;
165 unsigned int raw_table_size_;
166 unsigned int projected_element_count_;
167 unsigned int inserted_element_count_;
168 unsigned long long int random_seed_;
169 double desired_false_positive_probability_;
180 #endif // PSYNC_BLOOM_FILTER_HPP
unsigned long long int random_seed
unsigned int minimum_size
unsigned int minimum_number_of_hashes
bool operator==(const BloomFilter &bf1, const BloomFilter &bf2)
unsigned int projected_element_count
unsigned int maximum_number_of_hashes
unsigned int number_of_hashes
std::ostream & operator<<(std::ostream &out, const BloomFilter &bf)
std::vector< cell_type >::iterator Iterator
unsigned int maximum_size
double false_positive_probability
optimal_parameters_t optimal_parameters