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

In This Package:

GiGaMap.h

Go to the documentation of this file.
00001 // $Id: GiGaMap.h,v 1.4 2007/10/03 15:21:09 gcorti Exp $
00002 // ============================================================================
00003 // CVS tag $Name: v19r4 $
00004 // ============================================================================
00005 // $Log: GiGaMap.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_GIGAMAP_H 
00020 #define GIGA_GIGAMAP_H 1
00021 // Include files
00022 #ifdef WIN32
00023 #include "GaudiKernel/HashMap.h" // GaudiKernel (only for Visual-C Win32)
00024 #include "GiGa/GiGaHash.h"         // GiGa        (only for Visual-C Win32)
00025 #include <vector>
00026 #else 
00027 #include <map>                     // STD & STL   (except for Visual-C Win32)
00028 #endif 
00029 
00041 template<class KEY, class VALUE>
00042 class GiGaMap 
00043 {
00044 public:
00045   
00047   typedef  KEY                   Key      ;
00049   typedef  VALUE                 Value    ;
00050   
00051 #ifdef WIN32 
00052 
00055   typedef GaudiUtils::HashMap<Key,Value,GiGaHash<Key> >  Map  ; 
00056 #else 
00057 
00060   typedef typename std::map<Key,Value> Map;
00061 #endif
00062   
00066   typedef typename Map::iterator iterator;
00067   
00071   typedef typename Map::const_iterator const_iterator;
00072   
00073 public:
00074   
00076   GiGaMap() 
00077     : m_map  () 
00078   {};
00079   
00081   virtual ~GiGaMap() { clear() ; };
00082   
00094   inline Value& operator() ( const Key& key )
00095   { return m_map[key]; };
00096 
00108   inline Value& operator[] ( const Key& key ) { return (*this)( key ); }
00109   
00115   void erase( iterator first , 
00116               iterator last  )
00117   {
00118     m_map.erase( first , last ); 
00119   };
00120   
00126   void erase( iterator it )
00127   {
00128     m_map.erase  ( it        ); 
00129   };
00130   
00136   void erase( const Key& key ) 
00137   {
00138     m_map.erase  ( key ) ;
00139   };
00140   
00142   void clear() { m_map.clear() ; }
00143   
00147   unsigned int  size() const { return m_map.size(); }
00148   
00152   typename Map::iterator begin() { return m_map.begin(); }
00153 
00157   typename Map::const_iterator begin () const { return m_map.begin(); }
00158 
00162   typename Map::iterator end() { return m_map.end(); }
00163 
00167   typename Map::const_iterator end() const { return m_map.end(); }
00168 
00169 private:
00170   
00171   Map m_map                ;   
00172   
00173 };
00174 
00175 // ============================================================================'
00176 // The END 
00177 // ============================================================================
00178 #endif // GIGA_GIGAMAP_H
00179 // ============================================================================
| 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