| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

EventContext.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_EVENTCONTEXT_H
2 #define GAUDIKERNEL_EVENTCONTEXT_H 1
3
4 #include <iostream>
5 #include <unistd.h>
6 #include <limits>
7 #include "GaudiKernel/EventIDBase.h"
8
23 class IProxyDict;
24
25 class EventContext{
26 public:
27 typedef size_t ContextID_t;
28 typedef size_t ContextEvt_t;
29
30 static const ContextID_t INVALID_CONTEXT_ID = std::numeric_limits<ContextID_t>::max();
31 static const ContextEvt_t INVALID_CONTEXT_EVT = std::numeric_limits<ContextEvt_t>::max();
32
33
34 EventContext() {};
35 EventContext(const ContextEvt_t& e, const ContextID_t& s=INVALID_CONTEXT_ID)
36 :m_evt_num(e), m_evt_slot(s) {
37 m_valid = (e == INVALID_CONTEXT_EVT || s == INVALID_CONTEXT_ID) ? false: true;
38 }
39
40 ContextEvt_t evt() const { return m_evt_num; }
41 ContextID_t slot() const { return m_evt_slot; }
42 bool valid() const {return m_valid;}
43 IProxyDict* proxy() const { return m_proxy; }
44 const EventIDBase& eventID() const { return m_eid; }
45
46 void set(const ContextEvt_t& e=0, const ContextID_t& s=INVALID_CONTEXT_ID) {
47 m_valid = (e == INVALID_CONTEXT_EVT || s == INVALID_CONTEXT_ID) ? false : true;
48 m_evt_num = e;
49 m_evt_slot = s;
50 }
51
52 void setEvt(const ContextEvt_t& e) {
53 if (e == INVALID_CONTEXT_EVT) setValid(false);
54 m_evt_num = e;
55 }
56
57 void setSlot(const ContextID_t& s) {
58 if ( s == INVALID_CONTEXT_ID ) setValid(false);
59 m_evt_slot = s;
60 }
61
62 void setValid(const bool& b=true) {
63 m_valid = b;
64 if (!m_valid) {
65 m_evt_slot = INVALID_CONTEXT_ID;
66 m_evt_num = INVALID_CONTEXT_EVT;
67 }
68 }
69
70 void setEventID(const EventIDBase& e) {
71 m_eid = e;
72 }
73
74 void setProxy(IProxyDict* prx) {
75 m_proxy = prx;
76 }
77
78
79 private:
80 ContextEvt_t m_evt_num {INVALID_CONTEXT_EVT};
81 ContextID_t m_evt_slot {INVALID_CONTEXT_ID};
82 bool m_valid {false};
83
84 IProxyDict* m_proxy {0};
85
86 EventIDBase m_eid {};
87 };
88
89 inline std::ostream& operator<<( std::ostream& os, const EventContext& ctx ) {
90 if (ctx.valid()) {
91 return os << "s: " << ctx.slot() << " e: " << ctx.evt();
92 } else {
93 return os << "INVALID";
94 }
95 }
96
97 inline std::ostream& operator<< (std::ostream& os, const EventContext* c) {
98 if (c != 0) {
99 return os << *c;
100 } else {
101 return os << "INVALID";
102 }
103 }
104
105
106
107 #endif //GAUDIKERNEL_EVENTCONTEXT_H
EventContext::m_valid
bool m_valid
Definition: EventContext.h:82
EventContext::setEvt
void setEvt(const ContextEvt_t &e)
Definition: EventContext.h:52
gaudirun.c
c
Definition: gaudirun.py:391
EventContext::setEventID
void setEventID(const EventIDBase &e)
Definition: EventContext.h:70
EventContext::slot
ContextID_t slot() const
Definition: EventContext.h:41
EventContext::m_evt_slot
ContextID_t m_evt_slot
Definition: EventContext.h:81
EventContext::INVALID_CONTEXT_EVT
static const ContextEvt_t INVALID_CONTEXT_EVT
Definition: EventContext.h:31
EventContext::setSlot
void setSlot(const ContextID_t &s)
Definition: EventContext.h:57
EventContext
This class represents an entry point to all the event specific data.
Definition: EventContext.h:25
EventContext::ContextID_t
size_t ContextID_t
Definition: EventContext.h:27
EventContext::evt
ContextEvt_t evt() const
Definition: EventContext.h:40
EventIDBase.h
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
EventContext::proxy
IProxyDict * proxy() const
Definition: EventContext.h:43
EventContext::m_eid
EventIDBase m_eid
Definition: EventContext.h:86
EventContext::setProxy
void setProxy(IProxyDict *prx)
Definition: EventContext.h:74
EventContext::EventContext
EventContext(const ContextEvt_t &e, const ContextID_t &s=INVALID_CONTEXT_ID)
Definition: EventContext.h:35
EventContext::INVALID_CONTEXT_ID
static const ContextID_t INVALID_CONTEXT_ID
Definition: EventContext.h:30
EventContext::m_proxy
IProxyDict * m_proxy
Definition: EventContext.h:84
std::numeric_limits::max
T max(T...args)
EventContext::m_evt_num
ContextEvt_t m_evt_num
Definition: EventContext.h:80
EventIDBase
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition: EventIDBase.h:29
gaudirun.s
string s
Definition: gaudirun.py:245
EventContext::setValid
void setValid(const bool &b=true)
Definition: EventContext.h:62
EventContext::eventID
const EventIDBase & eventID() const
Definition: EventContext.h:44
EventContext::EventContext
EventContext()
Definition: EventContext.h:34
EventContext::ContextEvt_t
size_t ContextEvt_t
Definition: EventContext.h:28
operator<<
std::ostream & operator<<(std::ostream &os, const EventContext &ctx)
Definition: EventContext.h:89
std::ostream
STL class.
EventContext::valid
bool valid() const
Definition: EventContext.h:42