feisty meow concerns codebase  2.140
structures::string_hasher Class Reference

Implements a simple hashing algorithm for strings. More...

#include <string_hasher.h>

Inheritance diagram for structures::string_hasher:
Collaboration diagram for structures::string_hasher:

Public Member Functions

virtual basis::un_int hash (const void *key_data, int key_length) const
 returns a value that can be used to index into a hash table. More...
 
virtual hashing_algorithmclone () const
 implements cloning of the algorithm object. More...
 

Detailed Description

Implements a simple hashing algorithm for strings.

This uses a portion of the string's contents to create a hash value.

Definition at line 25 of file string_hasher.h.

Member Function Documentation

◆ clone()

hashing_algorithm * structures::string_hasher::clone ( ) const
virtual

implements cloning of the algorithm object.

Implements structures::hashing_algorithm.

Definition at line 30 of file string_hasher.cpp.

◆ hash()

basis::un_int structures::string_hasher::hash ( const void *  key_data,
int  key_length 
) const
virtual

returns a value that can be used to index into a hash table.

the returned value is loosely based on the "key_data" and the "key_length" we are provided with. it is expected that the "key_data" really is a 'char' pointer whose length is "key_length" (including the zero terminator at the end).

Implements structures::hashing_algorithm.

Definition at line 33 of file string_hasher.cpp.

References structures::MAX_STRING_CHARS_USED, and basis::minimum().

Referenced by structures::astring_hasher::hash().


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