BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/Nef_S2/Generic_handle_map.h
Go to the documentation of this file.
00001 // Copyright (c) 1997-2002  Max-Planck-Institute Saarbruecken (Germany).
00002 // All rights reserved.
00003 //
00004 // This file is part of CGAL (www.cgal.org); you may redistribute it under
00005 // the terms of the Q Public License version 1.0.
00006 // See the file LICENSE.QPL distributed with CGAL.
00007 //
00008 // Licensees holding a valid commercial license may use this file in
00009 // accordance with the commercial license agreement provided with the software.
00010 //
00011 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 //
00014 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Nef_S2/include/CGAL/Nef_S2/Generic_handle_map.h $
00015 // $Id: Generic_handle_map.h 28567 2006-02-16 14:30:13Z lsaboret $
00016 // 
00017 //
00018 // Author(s)     : Michael Seel  <seel@mpi-sb.mpg.de>
00019 
00020 #ifndef CGAL_GENERIC_HANDLE_MAP_H
00021 #define CGAL_GENERIC_HANDLE_MAP_H
00022 
00023 #include <CGAL/Unique_hash_map.h>
00024 
00025 CGAL_BEGIN_NAMESPACE
00026 
00027 struct Void_handle_hash_function {
00028     std::size_t operator() (void* h) const { 
00029         return std::size_t(h);
00030     }
00031 };
00032 
00033 
00034 template <class I>
00035 class Generic_handle_map : public 
00036   Unique_hash_map<void*,I,Void_handle_hash_function>
00037 { typedef Unique_hash_map<void*,I,Void_handle_hash_function> Base;
00038 public:
00039   Generic_handle_map() : Base() {}
00040   Generic_handle_map(I i) : Base(i) {}
00041 
00042   template <class H>
00043   const I& operator[](H h) const 
00044   { return Base::operator[](&*h); }
00045 
00046   template <class H>
00047   I& operator[](H h) 
00048   { return Base::operator[](&*h); }
00049 
00050 };
00051 
00052 CGAL_END_NAMESPACE
00053 #endif //CGAL_GENERIC_HANDLE_MAP_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines