The Gaudi Framework  v30r4 (9b837755)
EventContext Class Reference

This class represents an entry point to all the event specific data. More...

#include <GaudiKernel/EventContext.h>

Collaboration diagram for EventContext:

Public Types

using ContextID_t = size_t
 
using ContextEvt_t = size_t
 

Public Member Functions

 EventContext ()=default
 
 EventContext (const ContextEvt_t e, const ContextID_t s=INVALID_CONTEXT_ID, const ContextID_t subSlot=INVALID_CONTEXT_ID)
 
ContextEvt_t evt () const
 
ContextID_t slot () const
 
ContextID_t subSlot () const
 
bool usesSubSlot () const
 
bool valid () const
 
const EventIDBaseeventID () const
 
void set (const ContextEvt_t e=0, const ContextID_t s=INVALID_CONTEXT_ID, const ContextID_t subSlot=INVALID_CONTEXT_ID)
 
void setEvt (const ContextEvt_t e)
 
void setSlot (const ContextID_t s)
 
void setSubSlot (const ContextID_t subslot)
 
void setValid (const bool b=true)
 
void setEventID (const EventIDBase &e)
 
template<typename ValueType , typename... Args>
auto & emplaceExtension (Args &&...args)
 
template<typename T >
auto & setExtension (T &&t)
 
template<typename T >
auto & getExtension ()
 
template<typename T >
const auto & getExtension () const
 
bool hasExtension () const
 
template<typename T >
bool hasExtension () const
 
const std::type_infogetExtensionType () const
 

Static Public Attributes

static constexpr ContextID_t INVALID_CONTEXT_ID = std::numeric_limits<ContextID_t>::max()
 
static constexpr ContextEvt_t INVALID_CONTEXT_EVT = std::numeric_limits<ContextEvt_t>::max()
 

Private Attributes

EventIDBase m_eid {}
 
ContextEvt_t m_evt_num {INVALID_CONTEXT_EVT}
 
ContextID_t m_evt_slot {INVALID_CONTEXT_ID}
 
ContextID_t m_sub_slot {INVALID_CONTEXT_ID}
 
bool m_valid {false}
 
::evt_context_detail::any m_extension
 

Detailed Description

This class represents an entry point to all the event specific data.

It is needed to make the algorithm "aware" of the event it is operating on. This was not needed in the serial version of Gaudi where the assumption of 1-event-at-the-time processing was implicit.

This class has nothing to do with the AlgContextSvc or the Context of the EvtSelector!

Author
Danilo Piparo, Charles Leggett
Date
2012

Definition at line 31 of file EventContext.h.

Member Typedef Documentation

Definition at line 35 of file EventContext.h.

using EventContext::ContextID_t = size_t

Definition at line 34 of file EventContext.h.

Constructor & Destructor Documentation

EventContext::EventContext ( )
default
EventContext::EventContext ( const ContextEvt_t  e,
const ContextID_t  s = INVALID_CONTEXT_ID,
const ContextID_t  subSlot = INVALID_CONTEXT_ID 
)
inline

Definition at line 42 of file EventContext.h.

44  : m_evt_num( e ), m_evt_slot( s ), m_sub_slot( subSlot )
45  {
47  }
ContextID_t m_evt_slot
Definition: EventContext.h:139
static constexpr ContextEvt_t INVALID_CONTEXT_EVT
Definition: EventContext.h:38
static constexpr ContextID_t INVALID_CONTEXT_ID
Definition: EventContext.h:37
ContextEvt_t m_evt_num
Definition: EventContext.h:138
ContextID_t m_sub_slot
Definition: EventContext.h:140
string s
Definition: gaudirun.py:253
ContextID_t subSlot() const
Definition: EventContext.h:51

Member Function Documentation

template<typename ValueType , typename... Args>
auto& EventContext::emplaceExtension ( Args &&...  args)
inline

Definition at line 91 of file EventContext.h.

92  {
93 #if __cplusplus >= 201703
94  return m_extension.emplace<ValueType>( std::forward<Args>( args )... );
95 #else
96  return setExtension( ValueType( std::forward<Args>( args )... ) );
97 #endif
98  }
auto & setExtension(T &&t)
Definition: EventContext.h:101
::evt_context_detail::any m_extension
Definition: EventContext.h:143
const EventIDBase& EventContext::eventID ( ) const
inline

Definition at line 54 of file EventContext.h.

54 { return m_eid; }
EventIDBase m_eid
Definition: EventContext.h:137
ContextEvt_t EventContext::evt ( ) const
inline

Definition at line 49 of file EventContext.h.

49 { return m_evt_num; }
ContextEvt_t m_evt_num
Definition: EventContext.h:138
template<typename T >
auto& EventContext::getExtension ( )
inline

Definition at line 108 of file EventContext.h.

109  {
110  return ::evt_context_detail::any_cast<std::decay_t<T>&>( m_extension );
111  }
::evt_context_detail::any m_extension
Definition: EventContext.h:143
template<typename T >
const auto& EventContext::getExtension ( ) const
inline

Definition at line 114 of file EventContext.h.

115  {
116  return ::evt_context_detail::any_cast<std::decay_t<T> const&>( m_extension );
117  }
::evt_context_detail::any m_extension
Definition: EventContext.h:143
const std::type_info& EventContext::getExtensionType ( ) const
inline

Definition at line 134 of file EventContext.h.

134 { return m_extension.type(); }
::evt_context_detail::any m_extension
Definition: EventContext.h:143
bool EventContext::hasExtension ( ) const
inline

Definition at line 119 of file EventContext.h.

120  {
121 #if __cplusplus >= 201703
122  return m_extension.has_value();
123 #else
124  return !m_extension.empty();
125 #endif
126  }
::evt_context_detail::any m_extension
Definition: EventContext.h:143
template<typename T >
bool EventContext::hasExtension ( ) const
inline

Definition at line 129 of file EventContext.h.

130  {
131  return hasExtension() && m_extension.type() == typeid( std::decay_t<T> );
132  }
bool hasExtension() const
Definition: EventContext.h:119
::evt_context_detail::any m_extension
Definition: EventContext.h:143
void EventContext::set ( const ContextEvt_t  e = 0,
const ContextID_t  s = INVALID_CONTEXT_ID,
const ContextID_t  subSlot = INVALID_CONTEXT_ID 
)
inline

Definition at line 56 of file EventContext.h.

58  {
60  m_evt_num = e;
61  m_evt_slot = s;
63  }
ContextID_t m_evt_slot
Definition: EventContext.h:139
static constexpr ContextEvt_t INVALID_CONTEXT_EVT
Definition: EventContext.h:38
static constexpr ContextID_t INVALID_CONTEXT_ID
Definition: EventContext.h:37
ContextEvt_t m_evt_num
Definition: EventContext.h:138
ContextID_t m_sub_slot
Definition: EventContext.h:140
string s
Definition: gaudirun.py:253
ContextID_t subSlot() const
Definition: EventContext.h:51
void EventContext::setEventID ( const EventIDBase e)
inline

Definition at line 88 of file EventContext.h.

88 { m_eid = e; }
EventIDBase m_eid
Definition: EventContext.h:137
void EventContext::setEvt ( const ContextEvt_t  e)
inline

Definition at line 65 of file EventContext.h.

66  {
67  if ( e == INVALID_CONTEXT_EVT ) setValid( false );
68  m_evt_num = e;
69  }
static constexpr ContextEvt_t INVALID_CONTEXT_EVT
Definition: EventContext.h:38
ContextEvt_t m_evt_num
Definition: EventContext.h:138
void setValid(const bool b=true)
Definition: EventContext.h:79
template<typename T >
auto& EventContext::setExtension ( T &&  t)
inline

Definition at line 101 of file EventContext.h.

102  {
103  m_extension = std::forward<T>( t );
104  return getExtension<T>();
105  }
::evt_context_detail::any m_extension
Definition: EventContext.h:143
void EventContext::setSlot ( const ContextID_t  s)
inline

Definition at line 71 of file EventContext.h.

72  {
73  if ( s == INVALID_CONTEXT_ID ) setValid( false );
74  m_evt_slot = s;
75  }
ContextID_t m_evt_slot
Definition: EventContext.h:139
static constexpr ContextID_t INVALID_CONTEXT_ID
Definition: EventContext.h:37
string s
Definition: gaudirun.py:253
void setValid(const bool b=true)
Definition: EventContext.h:79
void EventContext::setSubSlot ( const ContextID_t  subslot)
inline

Definition at line 77 of file EventContext.h.

77 { m_sub_slot = subslot; }
ContextID_t m_sub_slot
Definition: EventContext.h:140
void EventContext::setValid ( const bool  b = true)
inline

Definition at line 79 of file EventContext.h.

80  {
81  m_valid = b;
82  if ( !m_valid ) {
85  }
86  }
ContextID_t m_evt_slot
Definition: EventContext.h:139
static constexpr ContextEvt_t INVALID_CONTEXT_EVT
Definition: EventContext.h:38
static constexpr ContextID_t INVALID_CONTEXT_ID
Definition: EventContext.h:37
ContextEvt_t m_evt_num
Definition: EventContext.h:138
ContextID_t EventContext::slot ( ) const
inline

Definition at line 50 of file EventContext.h.

50 { return m_evt_slot; }
ContextID_t m_evt_slot
Definition: EventContext.h:139
ContextID_t EventContext::subSlot ( ) const
inline

Definition at line 51 of file EventContext.h.

51 { return m_sub_slot; }
ContextID_t m_sub_slot
Definition: EventContext.h:140
bool EventContext::usesSubSlot ( ) const
inline

Definition at line 52 of file EventContext.h.

52 { return m_sub_slot != INVALID_CONTEXT_ID; }
static constexpr ContextID_t INVALID_CONTEXT_ID
Definition: EventContext.h:37
ContextID_t m_sub_slot
Definition: EventContext.h:140
bool EventContext::valid ( ) const
inline

Definition at line 53 of file EventContext.h.

53 { return m_valid; }

Member Data Documentation

constexpr ContextEvt_t EventContext::INVALID_CONTEXT_EVT = std::numeric_limits<ContextEvt_t>::max()
static

Definition at line 38 of file EventContext.h.

constexpr ContextID_t EventContext::INVALID_CONTEXT_ID = std::numeric_limits<ContextID_t>::max()
static

Definition at line 37 of file EventContext.h.

EventIDBase EventContext::m_eid {}
private

Definition at line 137 of file EventContext.h.

ContextEvt_t EventContext::m_evt_num {INVALID_CONTEXT_EVT}
private

Definition at line 138 of file EventContext.h.

ContextID_t EventContext::m_evt_slot {INVALID_CONTEXT_ID}
private

Definition at line 139 of file EventContext.h.

::evt_context_detail::any EventContext::m_extension
private

Definition at line 143 of file EventContext.h.

ContextID_t EventContext::m_sub_slot {INVALID_CONTEXT_ID}
private

Definition at line 140 of file EventContext.h.

bool EventContext::m_valid {false}
private

Definition at line 141 of file EventContext.h.


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