Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

PINDEX PChannel::HashFunction (  )  const [virtual, inherited]

Calculate a hash value for use in sets and dictionaries.

The hash function for strings will produce a value based on the sum of the first three characters of the string. This is a fairly basic function and make no assumptions about the string contents. A user may descend from PString and override the hash function if they can take advantage of the types of strings being used, eg if all strings start with the letter 'A' followed by 'B or 'C' then the current hash function will not perform very well.

Returns:
hash value for string.

Reimplemented from PObject.

Definition at line 319 of file pchannel.cxx.

References PChannel::GetHandle().

{
  return GetHandle()%97;
}


Generated by  Doxygen 1.6.0   Back to index