| The Gaudi Framework v29r1 (5cd95fa2)

- 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 <sstream>
16 #include <string>
17
23 class EventIDRange
24 {
25 public:
26 EventIDRange(){};
27 EventIDRange( const EventIDBase& start, const EventIDBase& stop );
28 EventIDRange( const EventIDRange& r ) : m_start( r.m_start ), m_stop( r.m_stop ){};
29 EventIDRange& operator=( const EventIDRange& r );
30
31 EventIDBase start() const { return m_start; }
32 EventIDBase stop() const { return m_stop; }
33
34 bool isInRange( const EventIDBase& t ) const { return ( t >= m_start && t < m_stop ); }
35
36 static EventIDRange intersect( const EventIDRange& it ) { return it; }
37 template <typename... T>
38 static EventIDRange intersect( const EventIDRange& first, const T&... rest )
39 {
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 EventIDBase m_start{};
57 EventIDBase m_stop{};
58 };
59
60 inline bool operator==( const EventIDRange& lhs, const EventIDRange& rhs )
61 {
62 return lhs.m_start == rhs.m_start && lhs.m_stop == rhs.m_stop;
63 }
64
65 inline bool operator!=( const EventIDRange& lhs, const EventIDRange& rhs ) { return !( lhs == rhs ); }
66
67 inline EventIDRange::operator std::string() const
68 {
69 std::ostringstream os;
70 os << "{" << m_start << " - " << m_stop << "}";
71 return os.str();
72 }
73
74 #endif
EventIDRange::intersect
static EventIDRange intersect(const EventIDRange &first, const T &...rest)
Definition: EventIDRange.h:38
EventIDRange::operator<<
friend std::ostream & operator<<(std::ostream &os, const EventIDRange &rhs)
Definition: EventIDRange.cpp:24
EventIDRange::operator==
friend bool operator==(const EventIDRange &lhs, const EventIDRange &rhs)
Definition: EventIDRange.h:60
EventIDRange::EventIDRange
EventIDRange(const EventIDRange &r)
Definition: EventIDRange.h:28
EventIDRange::m_stop
EventIDBase m_stop
Definition: EventIDRange.h:57
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:15
EventIDRange::operator!=
friend bool operator!=(const EventIDRange &lhs, const EventIDRange &rhs)
Definition: EventIDRange.h:65
std::ostringstream::str
T str(T...args)
EventIDRange::EventIDRange
EventIDRange()
Definition: EventIDRange.h:26
std::max
T max(T...args)
EventIDRange::intersect
static EventIDRange intersect(const EventIDRange &it)
Definition: EventIDRange.h:36
EventIDRange::stop
EventIDBase stop() const
Definition: EventIDRange.h:32
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:56
EventIDRange::start
EventIDBase start() const
Definition: EventIDRange.h:31
EventIDRange::isInRange
bool isInRange(const EventIDBase &t) const
Definition: EventIDRange.h:34
std::ostream
STL class.