| # Gaudi Framework, version v23r1 |

Home |  | Generated: Wed Feb 29 2012

# 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 "GaudiKernel/Map.h"
    00007 #include "GaudiKernel/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 {
    00025   // ==========================================================================
    00087   template <typename K, typename T,
    00088             typename H = Hash<K>,
    00089 #if defined(_WIN32)
    00090 // Marco Cl.: (work-around) it seems that Windows implementation of hash map is extremely slow
    00091 // we use a normal map instead.
    00092 //            typename M = stdext::hash_map<K,T,H>
    00093             typename M = std::map<K,T>
    00094 #elif defined(__ECC)
    00095             typename M = std::hash_map<K,T,H>
    00096 #elif defined(__ICC)
    00097             // icc uses the headers from GCC...
    00098             typename M = __gnu_cxx::hash_map<K,T,H>
    00099 #elif __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 3 )
    00100             typename M = __gnu_cxx::hash_map<K,T,H>
    00101 #elif __GNUC__ >= 4
    00102 // Marco Cl.: in gcc >= 4.3 the hash_map has been replaced by unordered_map
    00103 //          typename M = std::tr1::unordered_map<K,T,H>
    00104             typename M = __gnu_cxx::hash_map<K,T,H>
    00105 //            but gccxml has problems with it
    00106 #endif
    00107             >
    00108   class HashMap: public Map<K,T,M> {
    00109
    00110   public:
    00111     typedef H hasher;
    00112
    00113     inline hasher hash_funct() const {
    00114 // Marco Cl.: since on windows we are using a std::map, we have to provide a different implementation
    00115 // for GaudiUtils::HashMap::hash_funct(). (std::map::hash_funct does not exist)
    00116 #ifdef _WIN32
    00117       return hasher();
    00118 #else
    00119       return this->m_map.hash_funct();
    00120 #endif
    00121     }
    00122   };
    00123 } // namespace GaudiUtils
    00124
    00125 #endif // GAUDIKERNEL_GAUDIHASHMAP_H

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines