| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HashMap.h
Go to the documentation of this file.
1 // $Id: HashMap.h,v 1.7 2008/11/01 14:30:21 marcocle Exp $
2 #ifndef GAUDIKERNEL_HASHMAP_H
3 #define GAUDIKERNEL_HASHMAP_H 1
4
5 // Include files
6 #include "GaudiKernel/Map.h"
7 #include "GaudiKernel/Hash.h"
8
9 #if defined(_WIN32) || defined(__ECC)
10 #include <hash_map>
11 #elif defined(__ICC)
12 // icc uses the headers from GCC...
13 #include <ext/hash_map>
14 #elif __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 3 )
15 #include <ext/hash_map>
16 #elif __GNUC__ >= 4
17 // Marco Cl.: in gcc >= 4.3 the hash_map has been replaced by unordered_map
18 //#include <tr1/unordered_map>
19 // but gccxml has problems with it
20 #include <ext/hash_map>
21 #endif
22
23 namespace GaudiUtils
24 {
25 // ==========================================================================
87 template <typename K, typename T,
88 typename H = Hash<K>,
89 #if defined(_WIN32)
90 // Marco Cl.: (work-around) it seems that Windows implementation of hash map is extremely slow
91 // we use a normal map instead.
92 // typename M = stdext::hash_map<K,T,H>
93 typename M = std::map<K,T>
94 #elif defined(__ECC)
95 typename M = std::hash_map<K,T,H>
96 #elif defined(__ICC)
97 // icc uses the headers from GCC...
98 typename M = __gnu_cxx::hash_map<K,T,H>
99 #elif __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 3 )
100 typename M = __gnu_cxx::hash_map<K,T,H>
101 #elif __GNUC__ >= 4
102 // Marco Cl.: in gcc >= 4.3 the hash_map has been replaced by unordered_map
103 // typename M = std::tr1::unordered_map<K,T,H>
104 typename M = __gnu_cxx::hash_map<K,T,H>
105 // but gccxml has problems with it
106 #endif
107 >
108 class HashMap: public Map<K,T,M> {
109
110 public:
111 typedef H hasher;
112
113 inline hasher hash_funct() const {
114 // Marco Cl.: since on windows we are using a std::map, we have to provide a different implementation
115 // for GaudiUtils::HashMap::hash_funct(). (std::map::hash_funct does not exist)
116 #ifdef _WIN32
117 return hasher();
118 #else
119 return this->m_map.hash_funct();
120 #endif
121 }
122 };
123 } // namespace GaudiUtils
124
125 #endif // GAUDIKERNEL_GAUDIHASHMAP_H