| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

GiGaHashMap.h

Go to the documentation of this file.
00001 // $Id: GiGaHashMap.h,v 1.4 2007/10/03 15:21:09 gcorti Exp $
00002 // ============================================================================
00003 // CVS tag $Name: v19r4 $
00004 // ============================================================================
00005 // $Log: GiGaHashMap.h,v $
00006 // Revision 1.4  2007/10/03 15:21:09  gcorti
00007 // change to compile on Win32
00008 //
00009 // Revision 1.3  2003/07/07 16:48:09  ranjard
00010 // v14r2 - fix for gcc 3.2
00011 //
00012 // Revision 1.2  2002/12/03 21:46:59  ibelyaev
00013 //  small upgrade to improve CaloSim code
00014 //
00015 // Revision 1.1  2002/05/04 20:20:11  ibelyaev
00016 //  see $GIGAROOT/doc/release.notes (4 May 2002)
00017 //
00018 // ============================================================================
00019 #ifndef GIGA_GIGAHASHMAP_H 
00020 #define GIGA_GIGAHASHMAP_H 1
00021 // Include files
00022 #ifdef WIN32
00023 #include "GaudiKernel/HashMap.h" // GaudiKernel (only for Visual-C Win32)
00024 #include <vector>            
00025 #else 
00026 #if defined (__GNUC__) && ( __GNUC__ <= 2 )
00027 #include <hash_map>
00028 #else
00029 #include <ext/hash_map>
00030 using __gnu_cxx::hash_map;
00031 using __gnu_cxx::hash;
00032 #endif
00033 #endif 
00034 #include "GiGa/GiGaHash.h"
00035 
00048 template<class KEY, class VALUE>
00049 class GiGaHashMap 
00050 {
00051 public:
00052   
00054   typedef  KEY                      Key      ;
00056   typedef  VALUE                    Value    ;
00057   
00058 #ifdef WIN32 
00059 
00062   typedef  GaudiUtils::HashMap<Key,Value,GiGaHash<Key> > Map  ; 
00063 #else 
00064 
00067   typedef  hash_map<Key,Value> Map      ;
00068 #endif
00069   
00073   typedef typename Map::iterator iterator;
00074   
00078   typedef typename Map::const_iterator const_iterator ;
00079   
00080 public:
00081   
00083   GiGaHashMap () 
00084     : m_map   () 
00085   {}
00086   
00088   virtual ~GiGaHashMap() { clear() ; };
00089   
00101   inline Value& operator() ( const Key& key )
00102   { return m_map[key]; };
00103 
00115   inline Value& operator[] ( const Key& key ) { return (*this)( key ); }
00116   
00122   void erase( iterator first , 
00123               iterator last  )
00124   {
00125     m_map.erase( first , last ); 
00126   };
00127   
00133   void erase( iterator it )
00134   {
00135     m_map.erase  ( it        ); 
00136   };
00137   
00143   void erase( const Key& key ) 
00144   { 
00145     m_map.erase ( key ) ;
00146   };
00147 
00149   void clear() { m_map.clear() ; }
00150   
00154   unsigned int size() const { return m_map.size() ; }
00155 
00159   typename Map::iterator begin () { return m_map.begin () ; }
00160 
00164   typename Map::const_iterator begin () const {
00165     return m_map.begin ();
00166   }
00167 
00171   typename Map::iterator end() { return m_map.end   () ; }
00172 
00176   typename Map::const_iterator end() const { return m_map.end() ; }
00177 
00178 private:
00179 
00180   // the map iteself 
00181   Map  m_map  ; 
00182 
00183 };
00184 
00185 // ============================================================================
00186 // The End 
00187 // ============================================================================
00188 #endif // GIGA_GIGAHASHMAP_H
00189 // ============================================================================
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:01:14 2011 for GiGa by doxygen 1.4.7