Class HashId

Nested Relationships

Inheritance Relationships

Derived Type

Class Documentation

class aslam::HashId

128 bit hash.

Can be used as key to unordered containers.

Subclassed by aslam::Id

Public Functions

inline HashId()
inline HashId(const HashId &other)
inline HashId(const uint64_t source[2])
inline void fromUint64(const uint64_t source[2])
inline void toUint64(uint64_t destination[2]) const
inline const std::string hexString() const

Returns hexadecimal string for debugging or serialization.

inline const std::string shortHex() const

Returns a short hexadecimal tag.

inline bool fromHexString(const std::string &hexString)

Deserialize from hexadecimal string.

Serialization and Deserialization could be made more performant by using blobs.

inline size_t hashToSizeT() const

Rehashes the 128 bit hash to a 32/64 bit hash that can be used in STL containers.

This means that we will get collisions on the buckets, which is fine since we can disambiguate the actual hashes using operator==. So this does not increase the probability of ID collision.

inline size_t hashToSizeTFast() const

Rehashes the 128 bit hash to a 32/64 bit hash that can be used in STL containers.

This means that we will get collisions on the buckets, which is fine since we can disambiguate the actual hashes using operator==. So this does not increase the probability of ID collision. Version that skips prime multiplication for seeds that are already well distributed.

inline void randomize()

Randomizes to ID seeded from the nanosecond time of the first call of this function.

inline void operator=(const HashId &other)
inline bool operator<(const HashId &other) const
inline bool operator>(const HashId &other) const
inline bool operator==(const HashId &other) const
inline bool operator!=(const HashId &other) const
inline void setInvalid()

Invalidation mechanism.

inline bool isValid() const

Public Static Functions

static inline HashId random()

Generates a random Hash ID seeded from the nanosecond time of the first call of this function.