Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v28r2p1 (f1a77ff4)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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>
8 
23 class IProxyDict;
24 
26 public:
27  typedef size_t ContextID_t;
28  typedef size_t ContextEvt_t;
29 
32 
33 
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) {
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 
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 
98  if (c != 0) {
99  return os << *c;
100  } else {
101  return os << "INVALID";
102  }
103 }
104 
105 
106 
107 #endif //GAUDIKERNEL_EVENTCONTEXT_H
void setEvt(const ContextEvt_t &e)
Definition: EventContext.h:52
void setEventID(const EventIDBase &e)
Definition: EventContext.h:70
ContextID_t slot() const
Definition: EventContext.h:41
ContextID_t m_evt_slot
Definition: EventContext.h:81
static const ContextEvt_t INVALID_CONTEXT_EVT
Definition: EventContext.h:31
void setSlot(const ContextID_t &s)
Definition: EventContext.h:57
This class represents an entry point to all the event specific data.
Definition: EventContext.h:25
size_t ContextID_t
Definition: EventContext.h:27
ContextEvt_t evt() const
Definition: EventContext.h:40
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
IProxyDict * proxy() const
Definition: EventContext.h:43
EventIDBase m_eid
Definition: EventContext.h:86
void setProxy(IProxyDict *prx)
Definition: EventContext.h:74
EventContext(const ContextEvt_t &e, const ContextID_t &s=INVALID_CONTEXT_ID)
Definition: EventContext.h:35
static const ContextID_t INVALID_CONTEXT_ID
Definition: EventContext.h:30
IProxyDict * m_proxy
Definition: EventContext.h:84
ContextEvt_t m_evt_num
Definition: EventContext.h:80
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition: EventIDBase.h:29
string s
Definition: gaudirun.py:245
void setValid(const bool &b=true)
Definition: EventContext.h:62
const EventIDBase & eventID() const
Definition: EventContext.h:44
size_t ContextEvt_t
Definition: EventContext.h:28
std::ostream & operator<<(std::ostream &os, const EventContext &ctx)
Definition: EventContext.h:89
STL class.
bool valid() const
Definition: EventContext.h:42