expr_hash.h

Go to the documentation of this file.
00001 /*****************************************************************************/
00002 /*!
00003  * \file expr.h
00004  * \brief Definition of the API to expression package.  See class Expr for details.
00005  * 
00006  * Author: Clark Barrett
00007  * 
00008  * Created: Tue Nov 26 00:27:40 2002
00009  *
00010  * <hr>
00011  * Copyright (C) 2003 by the Board of Trustees of Leland Stanford
00012  * Junior University and by New York University. 
00013  *
00014  * License to use, copy, modify, sell and/or distribute this software
00015  * and its documentation for any purpose is hereby granted without
00016  * royalty, subject to the terms and conditions defined in the \ref
00017  * LICENSE file provided with this distribution.  In particular:
00018  *
00019  * - The above copyright notice and this permission notice must appear
00020  * in all copies of the software and related documentation.
00021  *
00022  * - THE SOFTWARE IS PROVIDED "AS-IS", WITHOUT ANY WARRANTIES,
00023  * EXPRESSED OR IMPLIED.  USE IT AT YOUR OWN RISK.
00024  * 
00025  * <hr>
00026  * 
00027  * Define std::hash<Expr> and std::hash<std::string> for hash_map and
00028  * hash_set over Expr class.
00029  */
00030 /*****************************************************************************/
00031 
00032 #ifndef _CVC_lite__expr_h_
00033 #include "expr.h"
00034 #endif
00035 
00036 #ifndef _cvcl__include__expr_hash_h_
00037 #define _cvcl__include__expr_hash_h_
00038 
00039 #ifdef HAVE_CONFIG_H
00040 #include "config.h"
00041 #endif
00042 
00043 #ifdef HAVE___GNU_CXX__EXT_HASH_MAP
00044 namespace __gnu_cxx
00045 #else
00046 namespace std
00047 #endif
00048 {
00049 
00050 template<> struct hash<CVCL::Expr>
00051 {
00052   size_t operator()(const CVCL::Expr& e) const { return e.hash(); }
00053 };
00054 
00055 template<> class hash<std::string> {
00056  private:  
00057   hash<const char*> h;
00058  public:
00059   size_t operator()(const std::string& s) const {
00060     return h(s.c_str());
00061   }
00062 };
00063 
00064 }
00065 
00066 #ifdef HAVE___GNU_CXX__EXT_HASH_MAP
00067 namespace std {
00068   using namespace __gnu_cxx;
00069 };
00070 #endif
00071 
00072 
00073 #endif

Generated on Thu Apr 13 16:57:31 2006 for CVC Lite by  doxygen 1.4.4