The Gaudi Framework  v30r3 (a5ef0a68)
EventIDRange.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_EVENTIDRANGE_H
2 #define GAUDIKERNEL_EVENTIDRANGE_H 1
3 
14 #include <iostream>
15 #include <sstream>
16 #include <string>
17 
24 {
25 public:
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:
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 {
70  os << "{" << m_start << " - " << m_stop << "}";
71  return os.str();
72 }
73 
74 #endif
static EventIDRange intersect(const EventIDRange &first, const T &...rest)
Definition: EventIDRange.h:38
friend std::ostream & operator<<(std::ostream &os, const EventIDRange &rhs)
friend bool operator==(const EventIDRange &lhs, const EventIDRange &rhs)
Definition: EventIDRange.h:60
EventIDRange(const EventIDRange &r)
Definition: EventIDRange.h:28
EventIDBase m_stop
Definition: EventIDRange.h:57
STL class.
T min(T...args)
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Event ID Range object.
Definition: EventIDRange.h:23
EventIDRange & operator=(const EventIDRange &r)
friend bool operator!=(const EventIDRange &lhs, const EventIDRange &rhs)
Definition: EventIDRange.h:65
T max(T...args)
static EventIDRange intersect(const EventIDRange &it)
Definition: EventIDRange.h:36
EventIDBase stop() const
Definition: EventIDRange.h:32
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition: EventIDBase.h:60
EventIDBase m_start
Definition: EventIDRange.h:56
EventIDBase start() const
Definition: EventIDRange.h:31
bool isInRange(const EventIDBase &t) const
Definition: EventIDRange.h:34
STL class.