include/wipal/tool/hash.hh

00001 /*
00002  * WiPal - A library and a set of tools to manipulate wireless traces.
00003  * Copyright (C) 2007  Universite Pierre et Marie Curie - Paris 6
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00018  * MA  02110-1301  USA
00019  *
00020  * Author: Thomas Claveirole <thomas.claveirole@lip6.fr>
00021  */
00022 #ifndef TOOL_HASH_HH_
00023 # define TOOL_HASH_HH_
00024 
00025 # ifdef DONT_USE_HASH
00026 
00027 #  include <set>
00028 #  include <map>
00029 
00030 #  define HASH_NAMESPACE_BEGIN  namespace tool {
00031 #  define HASH_NAMESPACE_END    }
00032 
00033 namespace tool
00034 {
00035   template <class T>
00036   struct hash
00037   {
00038   };
00039 }
00040 
00041 # else // ! DONT_USE_HASH
00042 
00043 #  ifdef __GNUC__               // GCC
00044 
00045 #   if __GNUC__ < 3             // GCC < 3.0
00046 #    include <hash_set.h>
00047 #    include <hash_map.h>
00048 
00049 #    define HASH_NAMESPACE_BEGIN
00050 #    define HASH_NAMESPACE_END
00051 
00052 namespace tool
00053 {
00054   using ::hash_map;
00055   using ::hash_set;
00056 }
00057 
00058 #   else                        // GCC >= 3.0
00059 #    include <ext/hash_set>
00060 #    include <ext/hash_map>
00061 
00062 #    if __GNUC_MINOR__ == 0     // GCC 3.0
00063 
00064 #     define HASH_NAMESPACE_BEGIN       namespace std {
00065 #     define HASH_NAMESPACE_END         }
00066 
00067 namespace tool
00068 {
00069   using ::std::hash_map;
00070   using ::std::hash_set;
00071 }
00072 
00073 #    else                       // GCC 3.1 and later
00074 
00075 #     define HASH_NAMESPACE_BEGIN       namespace __gnu_cxx {
00076 #     define HASH_NAMESPACE_END         }
00077 
00078 namespace tool
00079 {
00080   using ::__gnu_cxx::hash_map;
00081   using ::__gnu_cxx::hash_set;
00082 }
00083 
00084 #    endif // __GNUC_MINOR__ == 0
00085 #   endif // __GNUC__ < 3
00086 
00087 #  else // ! __GNUC__           // ...  There are other compilers, right?
00088 
00089 #   include <hash_set>
00090 #   include <hash_map>
00091 
00092 #   define HASH_NAMESPACE_BEGIN namespace std {
00093 #   define HASH_NAMESPACE_END   }
00094 
00095 namespace tool
00096 {
00097   using ::std::hash_map;
00098   using ::std::hash_set;
00099 }
00100 
00101 #  endif // __GNUC__
00102 # endif // DONT_USE_HASH
00103 
00104 #endif // ! TOOL_HASH_HH_

Generated on Wed Jan 16 16:15:14 2008 for wipal by  doxygen 1.5.4