31#ifndef ETL_BLOOM_FILTER_INCLUDED
32#define ETL_BLOOM_FILTER_INCLUDED
48 namespace private_bloom_filter
87 WIDTH = etl::bitset<Desired_Width>::Allocated_Bits
104 flags.set(get_hash<THash1>(key));
106 if (!etl::is_same<THash2, null_hash>::value)
108 flags.set(get_hash<THash2>(key));
111 if (!etl::is_same<THash3, null_hash>::value)
113 flags.set(get_hash<THash3>(key));
124 bool exists1 = flags[get_hash<THash1>(key)];
129 if (!etl::is_same<THash2, null_hash>::value)
131 exists2 = flags[get_hash<THash2>(key)];
135 if (!etl::is_same<THash3, null_hash>::value)
137 exists3 = flags[get_hash<THash3>(key)];
140 return exists1 && exists2 && exists3;
156 return (100 *
count()) / WIDTH;
164 return flags.count();
174 template <
typename THash>
175 size_t get_hash(parameter_t key)
const
177 size_t hash = THash()(key);
ETL_CONSTEXPR14 TReturn fold_bits(TValue value)
Definition binary.h:243
Bitset forward declaration.
Definition bitset_legacy.h:1124
size_t width() const
Returns the width of the Bloom filter.
Definition bloom_filter.h:146
size_t count() const
Returns the number of filter flags set.
Definition bloom_filter.h:162
void clear()
Clears the bloom filter of all entries.
Definition bloom_filter.h:93
bool exists(parameter_t key) const
Definition bloom_filter.h:122
size_t usage() const
Returns the percentage of usage. Range 0 to 100.
Definition bloom_filter.h:154
void add(parameter_t key)
Definition bloom_filter.h:102
Definition bloom_filter.h:76
bitset_ext
Definition absolute.h:40
etl::conditional< etl::is_fundamental< T >::value||etl::is_pointer< T >::value, T, constT & >::type type
By default fundamental and pointer types are passed by value.
Definition parameter_type.h:46
Definition bloom_filter.h:52