The Gaudi Framework  master (82fdf313)
Loading...
Searching...
No Matches
HashMap.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11#pragma once
12
13#include <GaudiKernel/Hash.h>
14#include <GaudiKernel/Map.h>
15#include <unordered_map>
16
17namespace GaudiUtils {
78
79 template <typename K, typename T, typename H = Hash<K>, typename M = std::unordered_map<K, T, H>>
80 class HashMap : public Map<K, T, M> {
81 public:
82 typedef H hasher;
83 inline hasher hash_funct() const { return this->m_map.hash_funct(); }
84
88 friend std::ostream& operator<<( std::ostream& s, const GaudiUtils::HashMap<K, T, H, M>& m ) {
89 // Copy the hash map into a map to have it ordered by key.
90 return s << GaudiUtils::Map<K, T>( m.begin(), m.end() );
91 }
92 };
93
94} // namespace GaudiUtils
Common class providing an architecture-independent hash map.
Definition HashMap.h:80
friend std::ostream & operator<<(std::ostream &s, const GaudiUtils::HashMap< K, T, H, M > &m)
Serialize a GaudiUtils::HashMap in a python like format.
Definition HashMap.h:88
hasher hash_funct() const
Definition HashMap.h:83
Extension of the STL map.
Definition Map.h:83