31#ifndef ETL_BLOOM_FILTER_INCLUDED
32#define ETL_BLOOM_FILTER_INCLUDED
48 namespace private_bloom_filter
72 template <
size_t Desired_Width,
88 WIDTH = etl::bitset<Desired_Width>::Allocated_Bits
105 flags.set(get_hash<THash1>(key));
109 flags.set(get_hash<THash2>(key));
114 flags.set(get_hash<THash3>(key));
125 bool exists1 = flags[get_hash<THash1>(key)];
132 exists2 = flags[get_hash<THash2>(key)];
138 exists3 = flags[get_hash<THash3>(key)];
141 return exists1 && exists2 && exists3;
157 return (100 *
count()) / WIDTH;
165 return flags.count();
175 template <
typename THash>
176 size_t get_hash(parameter_t key)
const
178 size_t hash = THash()(key);
ETL_CONSTEXPR14 TReturn fold_bits(TValue value)
Definition binary.h:243
Bitset forward declaration.
Definition bitset_legacy.h:1130
size_t width() const
Returns the width of the Bloom filter.
Definition bloom_filter.h:147
size_t count() const
Returns the number of filter flags set.
Definition bloom_filter.h:163
void clear()
Clears the bloom filter of all entries.
Definition bloom_filter.h:94
bool exists(parameter_t key) const
Definition bloom_filter.h:123
size_t usage() const
Returns the percentage of usage. Range 0 to 100.
Definition bloom_filter.h:155
void add(parameter_t key)
Definition bloom_filter.h:103
Definition bloom_filter.h:77
is_same
Definition type_traits_generator.h:1104
bitset_ext
Definition absolute.h:39
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:48
Definition bloom_filter.h:52