Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Gaudi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Valentin Volkl
Gaudi
Commits
6f2225b3
Commit
6f2225b3
authored
13 years ago
by
Marco Clemencic
Browse files
Options
Downloads
Patches
Plain Diff
use std::unordered_map for the implementation of GaudiUtils::HashMap
parent
b88d3e60
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GaudiKernel/GaudiKernel/HashMap.h
+39
-46
39 additions, 46 deletions
GaudiKernel/GaudiKernel/HashMap.h
GaudiKernel/doc/release.notes
+4
-0
4 additions, 0 deletions
GaudiKernel/doc/release.notes
with
43 additions
and
46 deletions
GaudiKernel/GaudiKernel/HashMap.h
+
39
−
46
View file @
6f2225b3
// $Id: HashMap.h,v 1.7 2008/11/01 14:30:21 marcocle Exp $
#ifndef GAUDIKERNEL_HASHMAP_H
#define GAUDIKERNEL_HASHMAP_H 1
...
...
@@ -11,75 +10,72 @@
#elif defined(__ICC)
// icc uses the headers from GCC...
#include
<ext/hash_map>
#elif __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ <
3
)
#elif __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ <
5
)
#include
<ext/hash_map>
#elif __GNUC__ >= 4
// Marco Cl.: in gcc >= 4.3 the hash_map has been replaced by unordered_map
//#include <tr1/unordered_map>
// but gccxml has problems with it
#include
<ext/hash_map>
#include
<unordered_map>
#endif
namespace
GaudiUtils
namespace
GaudiUtils
{
// ==========================================================================
/** @class HashMap HashMap.h GaudiKernel/HashMap.h
*
* 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
* manipula
i
tons
*
* Due to helper base class Gaudi::Utils::MapBase, this class
* is "python-friendly", and one can perform all python
* manipulat
i
ons
* in intuitive way:
* @code
*
* >>> m = ... ## get the map
* >>> print m ## print the map a'la python class dict
* ...
* @code
*
* >>> 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
* >>> 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
* >>> 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
* >>> 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
*
* @endcode
*
* @attention One needs to redfine <c>__setitem__</c> and <c>__getitem__</c>
* >>> m.update( key, value ) ## update/insert key/value pair
*
* @endcode
*
* @attention One needs to red
e
fine <c>__setitem__</c> and <c>__getitem__</c>
* methods in python:
*
* @code
*
* >>> type(m).__setitem__ = Gaudi.Utils.MapBase.__setitem__
* >>> type(m).__getitem__ = Gaudi.Utils.MapBase.__getitem__
* @code
*
* >>> type(m).__setitem__ = Gaudi.Utils.MapBase.__setitem__
* >>> type(m).__getitem__ = Gaudi.Utils.MapBase.__getitem__
*
* >>> m[key] = value ## much more intuitive semantics for key insertion
*
* @endcode
* @endcode
* In a similar way <c>__delitem__</c> methods can be redefined.
* @warning
* To bypass some compilation probl
m
e (and to avoid the unne
s
essary
* expansion of dictionaries) it is ne
s
essary to exclude from
* To bypass some compilation proble
m
(and to avoid the unne
c
essary
* expansion of dictionaries) it is ne
c
essary to exclude from
* dictionary the following methods:
* - lower_bound
* - upper_bound
* - equal_range
* - insert
*
* @see Gaudi::Utils::MapBase
*
* - lower_bound
* - upper_bound
* - equal_range
* - insert
*
* @see Gaudi::Utils::MapBase
*
* @author Marco Clemencic
* @date 2005-10-06
*/
...
...
@@ -96,13 +92,10 @@ namespace GaudiUtils
#elif defined(__ICC)
// icc uses the headers from GCC...
typename
M
=
__gnu_cxx
::
hash_map
<
K
,
T
,
H
>
#elif __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ <
3
)
#elif __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ <
5
)
typename
M
=
__gnu_cxx
::
hash_map
<
K
,
T
,
H
>
#elif __GNUC__ >= 4
// Marco Cl.: in gcc >= 4.3 the hash_map has been replaced by unordered_map
// typename M = std::tr1::unordered_map<K,T,H>
typename
M
=
__gnu_cxx
::
hash_map
<
K
,
T
,
H
>
// but gccxml has problems with it
typename
M
=
std
::
unordered_map
<
K
,
T
,
H
>
#endif
>
class
HashMap
:
public
Map
<
K
,
T
,
M
>
{
...
...
This diff is collapsed.
Click to expand it.
GaudiKernel/doc/release.notes
+
4
−
0
View file @
6f2225b3
Package : GaudiKernel
Package manager : Marco Clemencic
! 2011-10-28 - Marco Clemencic
- Use unordered_map as internal implementation of GaudiUtils::HashMap from
gcc 4.5 on (requires C++0x).
! 2011-10-27 - Marco Clemencic
- Introduced the function System::getProcessTime(pid), the helper class
ProcessTime and a templated version of adjustTime in GaudiKernel/Timing.h
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment