| # Gaudi Framework, version v20r3
Generated: 24 Nov 2008

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