75#ifndef __ADS_BinaryFuseFilter
76 #define __ADS_BinaryFuseFilter
113template<
class T ,
class F = std::u
int8_t ,
class H = DefaultHash< T > >
114 requires( std::is_unsigned_v< F > && (
sizeof( F ) <= 4 ) )
162 std::uint64_t seed = 1 , H h = H() );
177 [[nodiscard]]
bool maybe(
const T & x )
const;
180 [[nodiscard]] std::size_t
size(
void )
const;
183 [[nodiscard]]
bool empty(
void )
const;
186 [[nodiscard]] std::size_t
bits(
void )
const;
189 [[nodiscard]] std::size_t
trials(
void )
const;
194 static constexpr std::string_view
persistName =
"BinaryFuseFilter";
206 [[nodiscard]]
static constexpr std::uint64_t
persistTag(
void ) {
207 return( detail::persistMix( {
sizeof( T ) ,
sizeof( F ) } ) );
217 static constexpr std::size_t kMaxTrials = 1000;
220 [[nodiscard]] std::uint64_t base(
const T & x )
const;
223 [[nodiscard]] std::uint64_t mixed( std::uint64_t b )
const;
226 [[nodiscard]] F fingerprint( std::uint64_t h )
const;
229 [[nodiscard]] std::uint32_t first( std::uint64_t h )
const;
233 [[nodiscard]] std::array< std::uint32_t , 3 > places( std::uint64_t h )
const;
236 void layout( std::size_t n );
240 bool build(
const std::vector< std::uint64_t > & B );
242 std::vector< F , MappableAllocator< F > > f_F;
243 std::uint64_t f_seed;
244 std::uint32_t f_L = 0;
245 std::uint32_t f_CL = 0;
247 std::size_t f_trials = 0;
251 static constexpr std::uint64_t kProductBit = std::uint64_t( 1 ) << 63;
263#include "ADS/set/impl/BinaryFuseFilter.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....
static constexpr std::string_view persistName
the name of the structure in a file [see Persistence.h]
Definition BinaryFuseFilter.h:194
bool empty(void) const
whether the filter has no key
std::size_t bits(void) const
the bits of the fingerprints
static constexpr std::uint64_t persistTag(void)
the parameters of the layout, in a file
Definition BinaryFuseFilter.h:206
static constexpr std::uint32_t persistOldestVersion
the oldest version read: 1, whose filters keep their fingerprints
Definition BinaryFuseFilter.h:203
BinaryFuseFilter(void)
the filter of no key
Definition BinaryFuseFilter.h:121
std::size_t trials(void) const
the seeds drawn by the build
static constexpr std::uint32_t persistVersion
the version of the layout in a file: 2, whose bit 63 of the trials says that the fingerprints are by ...
Definition BinaryFuseFilter.h:200
std::size_t size(void) const
the keys of the build, the repeated ones once each
void persist(A &a)
the members written to, or read from, the archive [see Persistence.h]
BinaryFuseFilter(const std::vector< T > &keys, std::uint64_t seed=1, H h=H())
the filter of the keys, which may repeat
bool maybe(const T &x) const
whether may be in the set: true for every key of the set, and for any other with probability about ,...