Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

file_ID_hash_s Struct Reference

A structure that provides a hashing function for file IDs. More...

#include <types-and-constants.hh>

List of all members.

Public Methods

size_t operator() (const file_ID_s &id) const


Detailed Description

A structure that provides a hashing function for file IDs.

This function is required because file IDs are not scalar values for which STL provides a default hashing operation.

Definition at line 300 of file types-and-constants.hh.


Member Function Documentation

size_t file_ID_hash_s::operator() const file_ID_s   id const [inline]
 

Definition at line 302 of file types-and-constants.hh.

00302                                                 {
00303 
00304     // Treat the value as a sequence of bytes, forming a hash from a
00305     // calculation borrowed from the strings hashing function in the
00306     // STL code itself.
00307     unsigned long int h = 0;
00308     char* s = (char*)&id;
00309     for (unsigned int i = 0; i < sizeof(file_ID_s); i++) {
00310       h = (5 * h) + *s;
00311       s++;
00312     }
00313 
00314     return (size_t)h;
00315   }


The documentation for this struct was generated from the following file:
Generated on Fri Jan 31 10:33:38 2003 for Laplace-merge by doxygen1.3-rc2