proj home

Files   Classes   Functions   Hierarchy  

stringpairhash.h

Go to the documentation of this file.
00001 #ifndef STRINGPAIRHASH_H
00002 #define STRINGPAIRHASH_H
00003 
00004 #include <stringhash.h>
00005 #include <typedefs.h>
00006 
00011 template< typename T >
00012 class stringpair
00013 {
00014 public:
00015 
00017   string id;
00019   T data;
00020 
00022   boolc operator == (stringpair const & x) const
00023     { return id == x.id; }
00024     
00026   stringpair(stringc & id_, T const & data_)
00027     : id(id_), data(data_) {}
00028 };
00029 
00033 template<typename T>
00034 class stringpairhash
00035 {
00036 public:
00037 
00039   stringhash sh;
00040 
00042   stringpairhash();
00044   uintc operator()(stringpair<T> const & x) const;
00045 };
00046 
00047 //---------------------------------------------------------
00048 // Implementation
00049 
00050 template<typename T>
00051 stringpairhash<T>::stringpairhash()
00052 {
00053   sh.construct(50,7);
00054 }
00055 
00056 template<typename T>
00057 uintc stringpairhash<T>::operator()(stringpair<T>const & x) const
00058 {
00059   return sh(x.id);
00060 }
00061 
00062 
00063 #endif
00064 

Generated on Fri Mar 4 00:49:26 2011 for Chelton Evans Source by  doxygen 1.5.8