ATLAS Offline Software
Public Member Functions | List of all members
std::hash< Guid > Struct Reference

#include <Guid.h>

Collaboration diagram for std::hash< Guid >:

Public Member Functions

size_t operator() (const Guid &g) const noexcept
 

Detailed Description

Definition at line 280 of file Guid.h.

Member Function Documentation

◆ operator()()

size_t std::hash< Guid >::operator() ( const Guid g) const
inlinenoexcept

Definition at line 281 of file Guid.h.

281  {
282  // Treat the Guid as a 16-byte array for hashing.
283  // Checking the memory layout is contiguous and test for padding at compile time.
284  static_assert(sizeof(Guid) == (sizeof(unsigned int) + sizeof(unsigned short)
285  + sizeof(unsigned short) + sizeof(std::array<unsigned char,8>)));
286  const unsigned char* bytes = reinterpret_cast<const unsigned char*>(&g);
287  size_t hash_value = 0;
288  // Simple hash combiner: FNV-1a inspired for 128-bit data
289  constexpr size_t fnv_prime = sizeof(size_t) == 8 ? 0x100000001b3ULL : 0x01000193U;
290  constexpr size_t fnv_offset = sizeof(size_t) == 8 ? 0xcbf29ce484222325ULL : 0x811c9dc5U;
291  hash_value = fnv_offset;
292  for (size_t i = 0; i < sizeof(Guid); ++i) {
293  hash_value ^= static_cast<size_t>(bytes[i]);
294  hash_value *= fnv_prime;
295  }
296  return hash_value;
297  }

The documentation for this struct was generated from the following file:
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
lumiFormat.i
int i
Definition: lumiFormat.py:85
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
Guid
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
Definition: Guid.h:25
CP::hash_value
std::size_t hash_value(const SystematicSet &)
Hash function specifically for boost::hash.
Definition: SystematicSet.cxx:319