libassetmap  1.0.0
Hash-table based archive format containing compressed data
Public Member Functions | List of all members
AssetMap::IHasher Class Referenceabstract
Inheritance diagram for AssetMap::IHasher:
Inheritance graph
[legend]

Public Member Functions

virtual uint64_t Hash (std::string_view data) const noexcept=0
 Computes an unsigned 64-bit value of an arbitrary string of bytes. More...
 
virtual size_t CalcBucket (uint64_t hash, size_t bucketCount) const noexcept=0
 Calculates the bucket index from a given hash and bucket count. More...
 
virtual size_t CalcBucketsForItemCount (size_t count) const noexcept=0
 Computes the preferred number of buckets the implementation wants for a given number of entries that will be inserted. More...
 

Member Function Documentation

◆ CalcBucket()

virtual size_t AssetMap::IHasher::CalcBucket ( uint64_t  hash,
size_t  bucketCount 
) const
pure virtualnoexcept

Calculates the bucket index from a given hash and bucket count.

Parameters
hasha hash previously computed with Hash()
bucketCountThe total number of buckets that exist.
Returns
The bucket that this entry should be found/placed in.

Implemented in AssetMap::CityHash.

◆ CalcBucketsForItemCount()

virtual size_t AssetMap::IHasher::CalcBucketsForItemCount ( size_t  count) const
pure virtualnoexcept

Computes the preferred number of buckets the implementation wants for a given number of entries that will be inserted.

Parameters
countThe total number of items that will be stored.
Returns
The number of buckets that are preferred for count input items.

Implemented in AssetMap::CityHash.

◆ Hash()

virtual uint64_t AssetMap::IHasher::Hash ( std::string_view  data) const
pure virtualnoexcept

Computes an unsigned 64-bit value of an arbitrary string of bytes.

Precondition
It is implementation defined whether data can be empty.
Parameters
dataa sequence of bytes to hash.
Returns
a 64-bit hash of data

Implemented in AssetMap::CityHash.


The documentation for this class was generated from the following file: