libassetmap  1.0.0
Hash-table based archive format containing compressed data
Hashers.h
1 #ifndef LIBASSETMAP_HASHERS_H
2 #define LIBASSETMAP_HASHERS_H
3 
4 #include "IHasher.h"
5 
6 namespace AssetMap {
7  class CityHash : public IHasher {
8  float bucketRatio;
9 
10  public:
16  explicit CityHash(float bucketRatio = 0.75f);
17 
21  [[nodiscard]] uint64_t Hash(std::string_view data) const noexcept override;
22 
31  [[nodiscard]] size_t CalcBucket(uint64_t hash,
32  size_t bucketCount) const noexcept override;
33 
41  [[nodiscard]] size_t
42  CalcBucketsForItemCount(size_t count) const noexcept override;
43  };
44 } // namespace AssetMap
45 
46 #endif // LIBASSETMAP_HASHERS_H
AssetMap::CityHash
Definition: Hashers.h:7
AssetMap::CityHash::Hash
uint64_t Hash(std::string_view data) const noexcept override
Compute the hash of a given string of bytes.
AssetMap::CityHash::CalcBucketsForItemCount
size_t CalcBucketsForItemCount(size_t count) const noexcept override
Calculates the total number of buckets that should be created for total file count.
AssetMap
Definition: DirectoryMetadata.h:65
AssetMap::CityHash::CalcBucket
size_t CalcBucket(uint64_t hash, size_t bucketCount) const noexcept override
Calculates the bucket to index given a hash and total bucket size.
AssetMap::CityHash::CityHash
CityHash(float bucketRatio=0.75f)
Constructs an instance of the CityHash class.
AssetMap::IHasher
Definition: IHasher.h:8