| The Gaudi Framework v32r1 (f65d50dc)

Public Types | Public Member Functions | Static Public Attributes | Private Attributes | List of all members
EventContext Class Reference

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

`#include <GaudiKernel/EventContext.h>`

Collaboration diagram for EventContext:
[legend]

## 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 EventIDBase & | eventID () 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_info & | getExtensionType () 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}
std::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 24 of file EventContext.h.

## Member Typedef Documentation

## ◆ ContextEvt_t

using EventContext::ContextEvt_t = size_t

Definition at line 27 of file EventContext.h.

## ◆ ContextID_t

using EventContext::ContextID_t = size_t

Definition at line 26 of file EventContext.h.

## Constructor & Destructor Documentation

## ◆ EventContext() [1/2]

EventContext::EventContext | ( |  | ) |
| default

## ◆ EventContext() [2/2]

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

Definition at line 34 of file EventContext.h.

36 : m_evt_num( e ), m_evt_slot( s ), m_sub_slot( subSlot ) {
37 m_valid = ( e != INVALID_CONTEXT_EVT && s != INVALID_CONTEXT_ID );
38 }
EventContext::m_valid
bool m_valid
Definition: EventContext.h:112
EventContext::m_evt_slot
ContextID_t m_evt_slot
Definition: EventContext.h:110
EventContext::INVALID_CONTEXT_EVT
static constexpr ContextEvt_t INVALID_CONTEXT_EVT
Definition: EventContext.h:30
EventContext::INVALID_CONTEXT_ID
static constexpr ContextID_t INVALID_CONTEXT_ID
Definition: EventContext.h:29
EventContext::subSlot
ContextID_t subSlot() const
Definition: EventContext.h:42
EventContext::m_evt_num
ContextEvt_t m_evt_num
Definition: EventContext.h:109
EventContext::m_sub_slot
ContextID_t m_sub_slot
Definition: EventContext.h:111
gaudirun.s
string s
Definition: gaudirun.py:316

## Member Function Documentation

## ◆ emplaceExtension()

template<typename ValueType , typename... Args>

auto& EventContext::emplaceExtension | ( | Args &&... | args | ) |
| inline

Definition at line 78 of file EventContext.h.

78 {
79 return m_extension.emplace<ValueType>( std::forward<Args>( args )... );
80 }
gaudirun.args
args
Definition: gaudirun.py:307
EventContext::m_extension
std::any m_extension
Definition: EventContext.h:114

## ◆ eventID()

const EventIDBase& EventContext::eventID | ( |  | ) | const
| inline

Definition at line 45 of file EventContext.h.

45 { return m_eid; }
EventContext::m_eid
EventIDBase m_eid
Definition: EventContext.h:108

## ◆ evt()

ContextEvt_t EventContext::evt | ( |  | ) | const
| inline

Definition at line 40 of file EventContext.h.

40 { return m_evt_num; }
EventContext::m_evt_num
ContextEvt_t m_evt_num
Definition: EventContext.h:109

## ◆ getExtension() [1/2]

template<typename T >

auto& EventContext::getExtension | ( |  | ) |
| inline

Definition at line 89 of file EventContext.h.

89 {
90 return std::any_cast<std::decay_t<T>&>( m_extension );
91 }
EventContext::m_extension
std::any m_extension
Definition: EventContext.h:114

## ◆ getExtension() [2/2]

template<typename T >

const auto& EventContext::getExtension | ( |  | ) | const
| inline

Definition at line 94 of file EventContext.h.

94 {
95 return std::any_cast<std::decay_t<T> const&>( m_extension );
96 }
EventContext::m_extension
std::any m_extension
Definition: EventContext.h:114

## ◆ getExtensionType()

const std::type_info& EventContext::getExtensionType | ( |  | ) | const
| inline

Definition at line 105 of file EventContext.h.

105 { return m_extension.type(); }
EventContext::m_extension
std::any m_extension
Definition: EventContext.h:114

## ◆ hasExtension() [1/2]

bool EventContext::hasExtension | ( |  | ) | const
| inline

Definition at line 98 of file EventContext.h.

98 { return m_extension.has_value(); }
EventContext::m_extension
std::any m_extension
Definition: EventContext.h:114

## ◆ hasExtension() [2/2]

template<typename T >

bool EventContext::hasExtension | ( |  | ) | const
| inline

Definition at line 101 of file EventContext.h.

101 {
102 return hasExtension() && m_extension.type() == typeid( std::decay_t<T> );
103 }
EventContext::m_extension
std::any m_extension
Definition: EventContext.h:114
EventContext::hasExtension
bool hasExtension() const
Definition: EventContext.h:98

## ◆ set()

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 47 of file EventContext.h.

48 {
49 m_valid = ( e != INVALID_CONTEXT_EVT && s != INVALID_CONTEXT_ID );
50 m_evt_num = e;
51 m_evt_slot = s;
52 m_sub_slot = subSlot;
53 }
EventContext::m_valid
bool m_valid
Definition: EventContext.h:112
EventContext::m_evt_slot
ContextID_t m_evt_slot
Definition: EventContext.h:110
EventContext::INVALID_CONTEXT_EVT
static constexpr ContextEvt_t INVALID_CONTEXT_EVT
Definition: EventContext.h:30
EventContext::INVALID_CONTEXT_ID
static constexpr ContextID_t INVALID_CONTEXT_ID
Definition: EventContext.h:29
EventContext::subSlot
ContextID_t subSlot() const
Definition: EventContext.h:42
EventContext::m_evt_num
ContextEvt_t m_evt_num
Definition: EventContext.h:109
EventContext::m_sub_slot
ContextID_t m_sub_slot
Definition: EventContext.h:111
gaudirun.s
string s
Definition: gaudirun.py:316

## ◆ setEventID()

void EventContext::setEventID | ( | const EventIDBase & | e | ) |
| inline

Definition at line 75 of file EventContext.h.

75 { m_eid = e; }
EventContext::m_eid
EventIDBase m_eid
Definition: EventContext.h:108

## ◆ setEvt()

void EventContext::setEvt | ( | const ContextEvt_t | e | ) |
| inline

Definition at line 55 of file EventContext.h.

55 {
56 if ( e == INVALID_CONTEXT_EVT ) setValid( false );
57 m_evt_num = e;
58 }
EventContext::INVALID_CONTEXT_EVT
static constexpr ContextEvt_t INVALID_CONTEXT_EVT
Definition: EventContext.h:30
EventContext::m_evt_num
ContextEvt_t m_evt_num
Definition: EventContext.h:109
EventContext::setValid
void setValid(const bool b=true)
Definition: EventContext.h:67

## ◆ setExtension()

template<typename T >

auto& EventContext::setExtension | ( | T && | t | ) |
| inline

Definition at line 83 of file EventContext.h.

83 {
84 m_extension = std::forward<T>( t );
85 return getExtension<T>();
86 }
EventContext::m_extension
std::any m_extension
Definition: EventContext.h:114

## ◆ setSlot()

void EventContext::setSlot | ( | const ContextID_t | s | ) |
| inline

Definition at line 60 of file EventContext.h.

60 {
61 if ( s == INVALID_CONTEXT_ID ) setValid( false );
62 m_evt_slot = s;
63 }
EventContext::m_evt_slot
ContextID_t m_evt_slot
Definition: EventContext.h:110
EventContext::INVALID_CONTEXT_ID
static constexpr ContextID_t INVALID_CONTEXT_ID
Definition: EventContext.h:29
gaudirun.s
string s
Definition: gaudirun.py:316
EventContext::setValid
void setValid(const bool b=true)
Definition: EventContext.h:67

## ◆ setSubSlot()

void EventContext::setSubSlot | ( | const ContextID_t | subslot | ) |
| inline

Definition at line 65 of file EventContext.h.

65 { m_sub_slot = subslot; }
EventContext::m_sub_slot
ContextID_t m_sub_slot
Definition: EventContext.h:111

## ◆ setValid()

void EventContext::setValid | ( | const bool | b = `true` | ) |
| inline

Definition at line 67 of file EventContext.h.

67 {
68 m_valid = b;
69 if ( !m_valid ) {
70 m_evt_slot = INVALID_CONTEXT_ID;
71 m_evt_num = INVALID_CONTEXT_EVT;
72 }
73 }
EventContext::m_valid
bool m_valid
Definition: EventContext.h:112
EventContext::m_evt_slot
ContextID_t m_evt_slot
Definition: EventContext.h:110
EventContext::INVALID_CONTEXT_EVT
static constexpr ContextEvt_t INVALID_CONTEXT_EVT
Definition: EventContext.h:30
EventContext::INVALID_CONTEXT_ID
static constexpr ContextID_t INVALID_CONTEXT_ID
Definition: EventContext.h:29
EventContext::m_evt_num
ContextEvt_t m_evt_num
Definition: EventContext.h:109

## ◆ slot()

ContextID_t EventContext::slot | ( |  | ) | const
| inline

Definition at line 41 of file EventContext.h.

41 { return m_evt_slot; }
EventContext::m_evt_slot
ContextID_t m_evt_slot
Definition: EventContext.h:110

## ◆ subSlot()

ContextID_t EventContext::subSlot | ( |  | ) | const
| inline

Definition at line 42 of file EventContext.h.

42 { return m_sub_slot; }
EventContext::m_sub_slot
ContextID_t m_sub_slot
Definition: EventContext.h:111

## ◆ usesSubSlot()

bool EventContext::usesSubSlot | ( |  | ) | const
| inline

Definition at line 43 of file EventContext.h.

43 { return m_sub_slot != INVALID_CONTEXT_ID; }
EventContext::INVALID_CONTEXT_ID
static constexpr ContextID_t INVALID_CONTEXT_ID
Definition: EventContext.h:29
EventContext::m_sub_slot
ContextID_t m_sub_slot
Definition: EventContext.h:111

## ◆ valid()

bool EventContext::valid | ( |  | ) | const
| inline

Definition at line 44 of file EventContext.h.

44 { return m_valid; }
EventContext::m_valid
bool m_valid
Definition: EventContext.h:112

## Member Data Documentation

## ◆ INVALID_CONTEXT_EVT

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

Definition at line 30 of file EventContext.h.

## ◆ INVALID_CONTEXT_ID

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

Definition at line 29 of file EventContext.h.

## ◆ m_eid

EventIDBase EventContext::m_eid {}
| private

Definition at line 108 of file EventContext.h.

## ◆ m_evt_num

ContextEvt_t EventContext::m_evt_num {INVALID_CONTEXT_EVT}
| private

Definition at line 109 of file EventContext.h.

## ◆ m_evt_slot

ContextID_t EventContext::m_evt_slot {INVALID_CONTEXT_ID}
| private

Definition at line 110 of file EventContext.h.

## ◆ m_extension

std::any EventContext::m_extension
| private

Definition at line 114 of file EventContext.h.

## ◆ m_sub_slot

ContextID_t EventContext::m_sub_slot {INVALID_CONTEXT_ID}
| private

Definition at line 111 of file EventContext.h.

## ◆ m_valid

bool EventContext::m_valid {false}
| private

Definition at line 112 of file EventContext.h.

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

- GaudiKernel/GaudiKernel/EventContext.h