| The Gaudi Framework v28r2p1 (f1a77ff4)

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

- File List
- File Members

EventIDRange.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_EVENTIDRANGE_H
2 #define GAUDIKERNEL_EVENTIDRANGE_H 1
3
13 #include "GaudiKernel/EventIDBase.h"
14 #include <iostream>
15 #include <string>
16 #include <sstream>
17
23 class EventIDRange {
24 public:
25 EventIDRange() {};
26 EventIDRange( const EventIDBase& start, const EventIDBase& stop );
27 EventIDRange( const EventIDRange& r ):m_start(r.m_start),m_stop(r.m_stop) {};
28 EventIDRange& operator= (const EventIDRange& r);
29
30 EventIDBase start() const { return m_start; }
31 EventIDBase stop() const { return m_stop; }
32
33 bool isInRange(const EventIDBase& t) const {
34 return ( t>=m_start && t<m_stop );
35 }
36
37 static EventIDRange intersect(const EventIDRange& it) { return it; }
38 template <typename ... T>
39 static EventIDRange intersect(const EventIDRange& first, const T& ... rest) {
40 EventIDRange r = intersect(rest...);
41
42 EventIDBase i1 = std::max(first.start(), r.start());
43 EventIDBase i2 = std::min(first.stop(), r.stop());
44
45 return EventIDRange(i1,i2);
46 }
47
48 friend bool operator==(const EventIDRange& lhs, const EventIDRange& rhs);
49 friend bool operator!=(const EventIDRange& lhs, const EventIDRange& rhs);
50
51 friend std::ostream& operator<<(std::ostream& os, const EventIDRange& rhs);
52
53 operator std::string() const;
54
55 private:
56
57 EventIDBase m_start {};
58 EventIDBase m_stop {};
59
60 };
61
62 inline bool operator==(const EventIDRange& lhs, const EventIDRange& rhs) {
63 return lhs.m_start==rhs.m_start &&
64 lhs.m_stop==rhs.m_stop ;
65 }
66
67 inline bool operator!=(const EventIDRange& lhs, const EventIDRange& rhs) {
68 return ! (lhs == rhs);
69 }
70
71 inline EventIDRange::operator std::string () const {
72 std::ostringstream os;
73 os << "{" << m_start << " - " << m_stop << "}";
74 return os.str();
75 }
76
77 #endif
EventIDRange::intersect
static EventIDRange intersect(const EventIDRange &first, const T &...rest)
Definition: EventIDRange.h:39
EventIDRange::operator<<
friend std::ostream & operator<<(std::ostream &os, const EventIDRange &rhs)
Definition: EventIDRange.cpp:28
EventIDRange::operator==
friend bool operator==(const EventIDRange &lhs, const EventIDRange &rhs)
Definition: EventIDRange.h:62
EventIDRange::EventIDRange
EventIDRange(const EventIDRange &r)
Definition: EventIDRange.h:27
EventIDRange::m_stop
EventIDBase m_stop
Definition: EventIDRange.h:58
std::string
STL class.
std::min
T min(T...args)
EventIDBase.h
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
EventIDRange
Event ID Range object.
Definition: EventIDRange.h:23
std::ostringstream
STL class.
EventIDRange::operator=
EventIDRange & operator=(const EventIDRange &r)
Definition: EventIDRange.cpp:19
EventIDRange::operator!=
friend bool operator!=(const EventIDRange &lhs, const EventIDRange &rhs)
Definition: EventIDRange.h:67
std::ostringstream::str
T str(T...args)
EventIDRange::EventIDRange
EventIDRange()
Definition: EventIDRange.h:25
std::max
T max(T...args)
EventIDRange::intersect
static EventIDRange intersect(const EventIDRange &it)
Definition: EventIDRange.h:37
EventIDRange::stop
EventIDBase stop() const
Definition: EventIDRange.h:31
EventIDBase
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition: EventIDBase.h:29
EventIDRange::m_start
EventIDBase m_start
Definition: EventIDRange.h:57
EventIDRange::start
EventIDBase start() const
Definition: EventIDRange.h:30
EventIDRange::isInRange
bool isInRange(const EventIDBase &t) const
Definition: EventIDRange.h:33
std::ostream
STL class.