| # Gaudi Framework, version v21r7 |

Home |  | Generated: 22 Jan 2010

# HashMap.h

Go to the documentation of this file.

    00001 // $Id: HashMap.h,v 1.7 2008/11/01 14:30:21 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 #if defined(_WIN32) || defined(__ECC)
    00010 #include <hash_map>
    00011 #elif defined(__ICC)
    00012 // icc uses the headers from GCC...
    00013 #include <ext/hash_map>
    00014 #elif __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 3 )
    00015 #include <ext/hash_map>
    00016 #elif __GNUC__ >= 4
    00017 // Marco Cl.: in gcc >= 4.3 the hash_map has been replaced by unordered_map
    00018 //#include <tr1/unordered_map>
    00019 //            but gccxml has problems with it
    00020 #include <ext/hash_map>
    00021 #endif
    00022
    00023 namespace GaudiUtils {
    00024
    00033   template <typename K, typename T,
    00034             typename H = Hash<K>,
    00035 #if defined(_WIN32)
    00036 // Marco Cl.: (work-around) it seems that Windows implementation of hash map is extremely slow
    00037 // we use a normal map instead.
    00038 //            typename M = stdext::hash_map<K,T,H>
    00039             typename M = std::map<K,T>
    00040 #elif defined(__ECC)
    00041             typename M = std::hash_map<K,T,H>
    00042 #elif defined(__ICC)
    00043             // icc uses the headers from GCC...
    00044             typename M = __gnu_cxx::hash_map<K,T,H>
    00045 #elif __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 3 )
    00046             typename M = __gnu_cxx::hash_map<K,T,H>
    00047 #elif __GNUC__ >= 4
    00048 // Marco Cl.: in gcc >= 4.3 the hash_map has been replaced by unordered_map
    00049 //          typename M = std::tr1::unordered_map<K,T,H>
    00050             typename M = __gnu_cxx::hash_map<K,T,H>
    00051 //            but gccxml has problems with it
    00052 #endif
    00053             >
    00054   class HashMap: public Map<K,T,M> {
    00055
    00056   public:
    00057     typedef H hasher;
    00058
    00059     inline hasher hash_funct() const {
    00060 // Marco Cl.: since on windows we are using a std::map, we have to provide a different implementation
    00061 // for GaudiUtils::HashMap::hash_funct(). (std::map::hash_funct does not exist)
    00062 #ifdef _WIN32
    00063       return hasher();
    00064 #else
    00065       return this->m_map.hash_funct();
    00066 #endif
    00067     }
    00068   };
    00069 } // namespace GaudiUtils
    00070
    00071 #endif // GAUDIKERNEL_GAUDIHASHMAP_H