Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkStructHashFunction.h

Go to the documentation of this file.
00001 #ifndef ITKSTRUCTHASHFUNCTION_H 00002 #define ITKSTRUCTHASHFUNCTION_H 00003 00004 namespace itk 00005 { 00006 00019 template< class TInput > 00020 class StructHashFunction 00021 { 00022 public: 00023 00025 typedef StructHashFunction Self; 00026 00028 typedef TInput InputType; 00029 00030 unsigned int operator()( const InputType& key ) const; 00031 00032 }; 00033 00034 template< class TInput > 00035 inline unsigned int 00036 StructHashFunction< TInput > 00037 ::operator()( const InputType& key ) const 00038 { 00039 int len = sizeof( InputType ); 00040 const char* p = reinterpret_cast< const char* >( &key ); 00041 int hash = 0; 00042 while( len-- ) 00043 { 00044 hash = hash * 65 + *p++; 00045 } 00046 hash += (hash >> 5); 00047 return hash; 00048 } 00049 00050 } 00051 00052 #endif // ndef ITKSTRUCTHASHFUNCTION_H

Generated at Sat Mar 31 02:29:52 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000