|
Gaudi Framework, version v22r0 |
| Home | Generated: 9 Feb 2011 |
Common class providing an architecture-independent hash map. More...
#include <GaudiKernel/HashMap.h>


Public Types | |
| typedef H | hasher |
Public Member Functions | |
| hasher | hash_funct () const |
Common class providing an architecture-independent hash map.
Due to helper base class Gaudi::Utils::MapBase, this class is "python-friendly", and one can perform all python manipulaitons in intuitive way:
>>> m = ... ## get the map >>> print m ## print the map a'la python class dict ... >>> for key in m : print key, m[key] ## iteration over the map ... >>> for key,value in m.iteritems() : print key, value ... >>> keys = m.keys() ## get the list of keys >>> values = m.values () ## get the list of values >> items = m.items () ## get the list of items >>> if 'one' in m ## check the presence of the key in map >>> v = m.get(key', None) ## return m[key] for existing key, else None >>> del m[key] ## erase the key form the map >>> value m[key] ## unchecked access through the key ... >>> m.update( key, value ) ## update/insert key/value pair
__setitem__ and __getitem__ methods in python:>>> type(m).__setitem__ = Gaudi.Utils.MapBase.__setitem__ >>> type(m).__getitem__ = Gaudi.Utils.MapBase.__getitem__ >>> m[key] = value ## much more intuitive semantics for key insertion
In a similar way __delitem__ methods can be redefined.
Definition at line 108 of file HashMap.h.
| typedef H GaudiUtils::HashMap< K, T, H, M >::hasher |
| hasher GaudiUtils::HashMap< K, T, H, M >::hash_funct | ( | ) | const [inline] |
Definition at line 113 of file HashMap.h.
00113 { 00114 // Marco Cl.: since on windows we are using a std::map, we have to provide a different implementation 00115 // for GaudiUtils::HashMap::hash_funct(). (std::map::hash_funct does not exist) 00116 #ifdef _WIN32 00117 return hasher(); 00118 #else 00119 return this->m_map.hash_funct(); 00120 #endif 00121 }