Cachemere
Modular Caching Library for C++
Public Member Functions | List of all members
cachemere::policy::detail::HashMixer< Key, KeyHash > Class Template Reference

Functor used for generating a uniform sequence of numbers in a given value range for a given key. More...

#include <hash_mixer.h>

Inheritance diagram for cachemere::policy::detail::HashMixer< Key, KeyHash >:
Inheritance graph
[legend]
Collaboration diagram for cachemere::policy::detail::HashMixer< Key, KeyHash >:
Collaboration graph
[legend]

Public Member Functions

 HashMixer (const Key &key, size_t value_range)
 Constructor. More...
 
size_t operator() ()
 Generate the next value in the random sequence. More...
 

Detailed Description

template<typename Key, typename KeyHash>
class cachemere::policy::detail::HashMixer< Key, KeyHash >

Functor used for generating a uniform sequence of numbers in a given value range for a given key.

Template Parameters
KeyThe type of the key to be used as seed.
KeyHashThe functor to use for turning the provided key into a seed for the internal pseudo-random number generator.

Constructor & Destructor Documentation

◆ HashMixer()

template<typename Key , typename KeyHash >
cachemere::policy::detail::HashMixer< Key, KeyHash >::HashMixer ( const Key &  key,
size_t  value_range 
)

Constructor.

Parameters
keyThe key to use to seed this instance.
value_rangeThe upper bound of the value range. This mixer will return values in the range [0, value_range).

Member Function Documentation

◆ operator()()

template<typename Key , typename KeyHash >
size_t cachemere::policy::detail::HashMixer< Key, KeyHash >::operator()

Generate the next value in the random sequence.

Returns
The next value in the sequence.

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