90#ifndef __ADS_FingerprintPerfectHash
91 #define __ADS_FingerprintPerfectHash
109#include <string_view>
110#include <type_traits>
126template<
class T ,
class H = DefaultHash< T > >
167 double gamma = 2 , std::uint64_t seed = 1 ,
192 [[nodiscard]] std::size_t
size(
void )
const;
195 [[nodiscard]]
bool empty(
void )
const;
198 [[nodiscard]] std::size_t
bits(
void )
const;
201 [[nodiscard]] std::size_t
levels(
void )
const;
206 static constexpr std::string_view
persistName =
"FingerprintPerfectHash";
209 [[nodiscard]]
static constexpr std::uint64_t
persistTag(
void ) {
210 return( detail::persistMix( {
sizeof( T ) , kBlock } ) );
220 static constexpr std::size_t kMaxLevels = 64;
221 static constexpr std::size_t kBlock = 512;
224 [[nodiscard]] std::uint64_t base(
const T & k )
const;
227 [[nodiscard]]
static std::size_t place( std::uint64_t x , std::size_t i ,
231 [[nodiscard]] std::size_t rank( std::size_t g )
const;
233 std::uint64_t f_seed;
236 std::vector< std::uint64_t , MappableAllocator< std::uint64_t > > f_bits;
237 std::vector< std::uint32_t > f_rank;
238 std::vector< std::size_t > f_at;
239 std::vector< std::size_t > f_m;
252#include "ADS/dictionary/impl/FingerprintPerfectHash.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....
FingerprintPerfectHash(const std::vector< T > &keys, double gamma=2, std::uint64_t seed=1, H h=H())
the function of the distinct keys, with bits per key in each level
void persist(A &a)
the members written to, or read from, the archive [see Persistence.h]
std::size_t levels(void) const
the number of levels
std::size_t bits(void) const
the bits of the function: the levels, their ranks and their sizes
std::size_t size(void) const
the number of keys
T Key
the type of the keys
Definition FingerprintPerfectHash.h:136
static constexpr std::uint64_t persistTag(void)
the parameters of the layout, in a file
Definition FingerprintPerfectHash.h:209
std::size_t operator()(const T &k) const
the value of , in ; some value in it for a key out of
bool empty(void) const
true if there are no keys
static constexpr std::string_view persistName
the name of the structure in a file [see Persistence.h]
Definition FingerprintPerfectHash.h:206
FingerprintPerfectHash(void)
the function of no key
Definition FingerprintPerfectHash.h:133