The Gaudi Framework  v30r3 (a5ef0a68)
EventContextHash Class Reference

hash from EventContext so EvenContexts can be used as keys in unordered maps. More...

#include <GaudiKernel/EventContextHash.h>

Public Member Functions

size_t hash (const EventContext &ctx) const
 
bool equal (const EventContext &a, const EventContext &b) const
 
std::size_t operator() (const EventContext &ctx) const
 
bool operator() (const EventContext &ctx, const EventContext &ctxb) const
 

Detailed Description

hash from EventContext so EvenContexts can be used as keys in unordered maps.

Hash is crated by combining event number and event slot using the algorithm from boost::hash_combine()

Author
Sami Kama

Definition at line 13 of file EventContextHash.h.

Member Function Documentation

bool EventContextHash::equal ( const EventContext a,
const EventContext b 
) const
inline

Definition at line 22 of file EventContextHash.h.

22 { return hash( a ) == hash( b ); }
size_t hash(const EventContext &ctx) const
size_t EventContextHash::hash ( const EventContext ctx) const
inline

Definition at line 16 of file EventContextHash.h.

17  {
18  size_t en = ctx.evt();
19  size_t es = ctx.slot();
20  return en ^ ( es + ( en << 6 ) + ( en >> 2 ) );
21  }
ContextID_t slot() const
Definition: EventContext.h:40
ContextEvt_t evt() const
Definition: EventContext.h:39
std::size_t EventContextHash::operator() ( const EventContext ctx) const
inline

Definition at line 24 of file EventContextHash.h.

24 { return hash( ctx ); }
size_t hash(const EventContext &ctx) const
bool EventContextHash::operator() ( const EventContext ctx,
const EventContext ctxb 
) const
inline

Definition at line 25 of file EventContextHash.h.

25 { return equal( ctx, ctxb ); }
bool equal(const EventContext &a, const EventContext &b) const

The documentation for this class was generated from the following file: