cgul_rolling_hash_cxx Class Reference

C++ bindings for cgul_rolling_hash More...

#include <cgul_rolling_hash_cxx.h>

Collaboration diagram for cgul_rolling_hash_cxx:
Collaboration graph

Static Public Member Functions

static cgul_uint32_t hash (const char *block, size_t block_length)
 
static cgul_uint32_t roll (cgul_uint32_t hv, const char c_old, const char c_new, size_t block_length)
 

Detailed Description

This class provides the C++ bindings for cgul_rolling_hash. The main purpose of this class is to convert the C-style function calls and exception handling in cgul_rolling_hash into C++-style function calls and exception handling.

Member Function Documentation

§ hash()

static cgul_uint32_t cgul_rolling_hash_cxx::hash ( const char *  block,
size_t  block_length 
)
inlinestatic

This function calculates the hash value for length bytes in the block block. The main purpose of this function is to generate the initial hash value that can then be passed into roll(), but it can also be used as a stand-alone hash function.

Parameters
[in]blockblock of binary data
[in]block_lengthlength of block in bytes
Returns
hash value
See also
roll()
cgul_hash_cxx::hash_block()

References cgul_rolling_hash__hash().

§ roll()

static cgul_uint32_t cgul_rolling_hash_cxx::roll ( cgul_uint32_t  hv,
const char  c_old,
const char  c_new,
size_t  block_length 
)
inlinestatic

Peform a rolling hash calculation on the hash value hv by surgically removing the part of the hash value associated with the old character c_old that is being removed and adding the part of the hash value associated with the new character c_new that is being added. The initial value for hv should be obtained by calling hash(). The value for block_length should be same as what originally was passed into hash().

Parameters
[in]hvold hash value
[in]c_oldold character
[in]c_newnew character
[in]block_lengthlength of the block in bytes
Returns
new hash value
See also
hash()

References cgul_rolling_hash__roll().


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