Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members  

HashUtils.h

00001 /*
00002    Copyright (C) 2002 the Strongroom project
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    @author Ewald Snel
00010 */
00011 
00012 #ifndef __HASHUTILS_H
00013 #define __HASHUTILS_H
00014 
00015 #ifdef HAVE_CONFIG_H
00016 #include <config.h>
00017 #endif
00018 
00019 #include <string>
00020 
00021 #ifdef HAVE_EXT_HASH_MAP
00022 #include <ext/hash_map>
00023 #include <ext/hash_set>
00024 #else
00025 #include <hash_map>
00026 #include <hash_set>
00027 #endif
00028 
00029 #include <Common.h>
00030 
00031 
00032 using namespace std;
00033 
00034 #ifdef HAVE___GNU_CXX__HASH_MAP_INT_INT_
00035 using namespace __gnu_cxx;
00036 #endif
00037 
00038 // Hash functions (TODO: better hashing)
00039 struct _hash_string
00040 {
00041     std::size_t operator()( const std::string &key ) const
00042     {
00043         return hash<const char *>()( key.c_str() );
00044     }
00045 };
00046 
00047 struct _hash_NumID
00048 {
00049     std::size_t operator()( const NumID key ) const
00050     {
00051         return key;
00052     }
00053 };
00054 
00055 #endif

Generated on Wed Feb 18 13:45:55 2004 for strongroom by doxygen1.2.18