|
||||
File indexing completed on 2025-01-31 10:08:58
0001 /***********************************************************************************\ 0002 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations * 0003 * * 0004 * This software is distributed under the terms of the Apache version 2 licence, * 0005 * copied verbatim in the file "LICENSE". * 0006 * * 0007 * In applying this licence, CERN does not waive the privileges and immunities * 0008 * granted to it by virtue of its status as an Intergovernmental Organization * 0009 * or submit itself to any jurisdiction. * 0010 \***********************************************************************************/ 0011 #ifndef __EVENT_CONTEXT_HASH_H 0012 #define __EVENT_CONTEXT_HASH_H 0013 #include "GaudiKernel/EventContext.h" 0014 /** 0015 * @class EventContextHash Create a hash from EventContext so 0016 * EvenContexts can be used as keys in unordered maps. Hash is crated 0017 * by combining event number and event slot using the algorithm from 0018 * boost::hash_combine() 0019 * 0020 * @author Sami Kama 0021 */ 0022 0023 class EventContextHash { 0024 public: 0025 size_t hash( const EventContext& ctx ) const { 0026 size_t en = ctx.evt(); 0027 size_t es = ctx.slot(); 0028 return en ^ ( es + ( en << 6 ) + ( en >> 2 ) ); 0029 } 0030 bool equal( const EventContext& a, const EventContext& b ) const { return hash( a ) == hash( b ); } 0031 0032 std::size_t operator()( const EventContext& ctx ) const { return hash( ctx ); } 0033 bool operator()( const EventContext& ctx, const EventContext& ctxb ) const { return equal( ctx, ctxb ); } 0034 }; 0035 0036 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |