59#ifndef __ADS_BlockedBloomFilter
60 #define __ADS_BlockedBloomFilter
91template<
class T ,
class H = DefaultHash< T > >
113 [[nodiscard]]
bool maybe(
const T & x )
const;
157 [[nodiscard]] std::size_t
size(
void )
const;
160 [[nodiscard]]
bool empty(
void )
const;
163 [[nodiscard]] std::size_t
bits(
void )
const;
166 [[nodiscard]] std::size_t
blocks(
void )
const;
193 static constexpr std::string_view
persistName =
"BlockedBloomFilter";
196 [[nodiscard]]
static constexpr std::uint64_t
persistTag(
void ) {
197 return( detail::persistMix( {
sizeof( T ) } ) );
208 struct alignas( 32 ) Block
210 std::uint32_t w[ 8 ];
211 using persist_unit = std::uint32_t;
215 [[nodiscard]] std::uint64_t hash(
const T & x )
const;
218 [[nodiscard]] std::size_t block( std::uint64_t h )
const;
220 std::vector< Block , MappableAllocator< Block > > f_B;
234#include "ADS/set/impl/BlockedBloomFilter.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The engineered hash functions of ADS, beyond the book [see HashFunctions.h for those of section 7....
A file mapped in memory, shared by the structures that are read from it in place [see Persistence....
The vector kernels of ADS that are inlined in the middle of a search, on Google Highway,...
void persist(A &a)
the members written to, or read from, the archive [see Persistence.h]
void insert(const T &x)
into the filter, by insertHash() of its hash
BlockedBloomFilter(void)
a filter of one block, empty
Definition BlockedBloomFilter.h:98
void insertHash(std::uint64_t h)
the hash of 64 bits, which must be random, into the filter
std::size_t size(void) const
the insertions made
static constexpr std::string_view persistName
the name of the structure in a file [see Persistence.h]
Definition BlockedBloomFilter.h:193
static constexpr std::uint64_t persistTag(void)
the parameters of the layout, in a file
Definition BlockedBloomFilter.h:196
bool empty(void) const
whether no item was inserted
void unite(const BlockedBloomFilter &o)
the items of o added, as if they had been inserted here, by the OR of the blocks
BlockedBloomFilter(std::size_t n, double bitsPerItem=10, H h=H())
the empty filter of about bitsPerItem bits for each of items, in at least one block,...
std::size_t bits(void) const
the bits, 256 per block
bool maybeHash(std::uint64_t h) const
whether the hash may be in the set: false only if it was never inserted
std::size_t blocks(void) const
the blocks
bool maybe(const T &x) const
whether may be in the set, by maybeHash() of its hash: false only if was never inserted
double falsePositiveRate(void) const
the expected false positives after the insertions made, the mean over the Poisson loads of the blocks...
void clear(void)
removes all the items