Simple Application Framework  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Protected Attributes
Saf::Algo::Struct::HashPolicy::PrimePolicy Class Reference

Hash table policy where the bucket count is always a prime number. More...

#include <HashTablePolicy.h>

List of all members.

Public Member Functions

Size BucketIndex (Size hash, Size buckets) const
 Convert hash value to a bucket index.
Size NextBucketCount (Size bucketHint) const
 Return bucket count greater or equal to bucketHint complying to the policy rules.
Size OptimalBucketCount (Size bucketHint, Size elements) const
 Return optimal bucket count for given number of elements greater or equal to bucketHint.
Collection::Pair< bool, SizeShouldResize (Size elements, Size buckets) const
 Check whether the table should resize.

Static Protected Attributes

static Size ms_primeList []
 Selected prime numbers.
static Size ms_primes
 Number of avilable primes.

Detailed Description

Hash table policy where the bucket count is always a prime number.

Possibly slower than PowerOf2Policy but more likely to avoid collisions.


Member Function Documentation

Convert hash value to a bucket index.

Return bucket count greater or equal to bucketHint complying to the policy rules.

Size Saf::Algo::Struct::HashPolicy::PrimePolicy::OptimalBucketCount ( Size  bucketHint,
Size  elements 
) const [inline]

Return optimal bucket count for given number of elements greater or equal to bucketHint.

Check whether the table should resize.

Currently the table is allowed to grow only, i.e., there is no minimum load factor.

Returns:
Pair where the first member indicates whether the table should be resized and the second member is the new size.

Member Data Documentation

Selected prime numbers.

Number of avilable primes.


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