Logo
~Sockets~
~Examples~
~Contact~


stringhasher Class Reference

#include <ServidorSAM.h>

List of all members.


Public Member Functions

size_t operator() (const string &str) const
bool operator() (const string &s1, const string &s2) const

Detailed Description

Definition at line 64 of file ServidorSAM.h.


Member Function Documentation

bool stringhasher::operator() const string &  s1,
const string &  s2
const [inline]
 

Definition at line 80 of file ServidorSAM.h.

00081         {
00082                 return s1 < s2;
00083         }

size_t stringhasher::operator() const string &  str  )  const [inline]
 

Definition at line 67 of file ServidorSAM.h.

00068         {
00069                 unsigned int hash = 0;
00070 
00071                 for(std::size_t i = 0; i < str.length(); i++)
00072                 {
00073                         hash ^= ((i & 1) == 0) ? (  (hash <<  7) ^ str[i] ^ (hash >> 3)) :
00074                                (~((hash << 11) ^ str[i] ^ (hash >> 5)));
00075                 }
00076 
00077                 return (hash & 0x7FFFFFFF);
00078         }


The documentation for this class was generated from the following file:
Page, code, and content Copyright (C) 2005 by Anders Hedström
Generated on Mon Aug 29 20:21:47 2005 for C++ Sockets by  doxygen 1.4.4