![]() |
|
|
Generated: 18 Jul 2008 |
00001 // $Id: HashMap.h,v 1.5 2007/05/23 17:13:30 marcocle Exp $ 00002 #ifndef GAUDIKERNEL_HASHMAP_H 00003 #define GAUDIKERNEL_HASHMAP_H 1 00004 00005 // Include files 00006 #include "Map.h" 00007 #include "Hash.h" 00008 00009 #ifdef __GNUC__ 00010 #include <ext/hash_map> 00011 #elif defined(_WIN32) || defined(__ICC) || defined(__ECC) 00012 #include <hash_map> 00013 #endif 00014 00015 namespace GaudiUtils { 00016 00025 template <typename K, typename T, 00026 typename H = Hash<K>, 00027 00028 #ifdef __GNUC__ 00029 typename M = __gnu_cxx::hash_map<K,T,H> 00030 #elif defined(_WIN32) 00031 // Marco Cl.: (work-around) it seems that Windows implementation of hash map is extremely slow 00032 // we use a normal map instead. 00033 // typename M = stdext::hash_map<K,T,H> 00034 typename M = std::map<K,T> 00035 #elif defined(__ICC) || defined(__ECC) 00036 typename M = std::hash_map<K,T,H> 00037 #endif 00038 > 00039 class HashMap: public Map<K,T,M> { 00040 00041 public: 00042 typedef H hasher; 00043 00044 inline hasher hash_funct() const { 00045 // Marco Cl.: since on windows we are using a std::map, we have to provide a different implementation 00046 // for GaudiUtils::HashMap::hash_funct(). (std::map::hash_funct does not exist) 00047 #ifdef _WIN32 00048 return hasher(); 00049 #else 00050 return this->m_map.hash_funct(); 00051 #endif 00052 } 00053 }; 00054 } // namespace GaudiUtils 00055 00056 #endif // GAUDIKERNEL_GAUDIHASHMAP_H