EventRange.h
Go to the documentation of this file.
1 #ifndef canvas_Persistency_Provenance_EventRange_h
2 #define canvas_Persistency_Provenance_EventRange_h
3 // vim: set sw=2 expandtab :
4 
5 // An EventRange has a SubRun number, and two event numbers
6 // corresponding to the half-open range:
7 //
8 // [beginEvent, endEvent)
9 
11 #include "canvas/Utilities/Level.h"
12 
13 #include <ostream>
14 
15 namespace art {
16 
17  class EventRange {
18  public:
19  static EventRange invalid() noexcept;
20  static EventRange forSubRun(SubRunNumber_t s) noexcept;
21  static bool are_valid(EventRange const& l, EventRange const& r) noexcept;
22 
23  ~EventRange() noexcept;
24  explicit EventRange() noexcept;
25 
26  // Note: Throws LogicError if begin > end.
27  explicit EventRange(SubRunNumber_t s,
30 
31  EventRange(EventRange const&) noexcept;
32  EventRange(EventRange&&) noexcept;
33  EventRange& operator=(EventRange const&) noexcept;
34  EventRange& operator=(EventRange&&) noexcept;
35 
36  bool operator<(EventRange const& other) const noexcept;
37  bool operator==(EventRange const& other) const noexcept;
38  bool operator!=(EventRange const& other) const noexcept;
39 
40  SubRunNumber_t subRun() const noexcept;
41  EventNumber_t begin() const noexcept;
42  EventNumber_t end() const noexcept;
43 
44  unsigned long long size() const noexcept;
45  bool empty() const noexcept;
46  bool is_valid() const noexcept;
47  bool is_full_subRun() const noexcept;
48  bool contains(SubRunNumber_t s, EventNumber_t e) const noexcept;
49 
50  // is_same(other) == true:
51  // implies is_subset(other) == true
52  // implies is_superset(other) == true
53  bool is_same(EventRange const& other) const noexcept;
54  bool is_adjacent(EventRange const& other) const noexcept;
55  bool is_disjoint(EventRange const& other) const noexcept;
56  bool is_subset(EventRange const& other) const noexcept;
57  bool is_superset(EventRange const& other) const noexcept;
58  bool is_overlapping(EventRange const& other) const noexcept;
59 
60  // Throws LogicError if we are a full SubRun range.
61  bool merge(EventRange const& other);
62 
63  // Throws LogicError if we are a full SubRun range.
64  // Throws LogicError if our begin_ > e.
65  void set_end(EventNumber_t const e);
66 
67  private:
68  // Throws LogicError if we are a full SubRun range.
69  void require_not_full_SubRun() const;
70 
74  };
75 
76  std::ostream& operator<<(std::ostream& os, EventRange const& r);
77 
78 } // namespace art
79 
80 #endif /* canvas_Persistency_Provenance_EventRange_h */
81 
82 // Local variables:
83 // mode: c++
84 // End:
void set_end(EventNumber_t const e)
Definition: EventRange.cc:213
bool empty() const noexcept
Definition: EventRange.cc:99
bool is_full_subRun() const noexcept
Definition: EventRange.cc:129
void require_not_full_SubRun() const
Definition: EventRange.cc:221
~EventRange() noexcept
bool operator==(EventRange const &other) const noexcept
Definition: EventRange.cc:80
unsigned long long size() const noexcept
Definition: EventRange.cc:123
SubRunNumber_t subRun_
Definition: EventRange.h:71
EventNumber_t end() const noexcept
Definition: EventRange.cc:111
static QStrList * l
Definition: config.cpp:1044
EventRange() noexcept
bool contains(SubRunNumber_t s, EventNumber_t e) const noexcept
Definition: EventRange.cc:136
static EventRange forSubRun(SubRunNumber_t s) noexcept
Definition: EventRange.cc:37
std::ostream & operator<<(std::ostream &os, const GroupSelector &gs)
static EventRange invalid() noexcept
Definition: EventRange.cc:30
const double e
bool is_same(EventRange const &other) const noexcept
Definition: EventRange.cc:143
IDNumber_t< Level::SubRun > SubRunNumber_t
Definition: IDNumber.h:119
bool is_disjoint(EventRange const &other) const noexcept
Definition: EventRange.cc:161
bool operator!=(EventRange const &other) const noexcept
Definition: EventRange.cc:87
EventNumber_t end_
Definition: EventRange.h:73
EventNumber_t begin_
Definition: EventRange.h:72
bool is_valid() const noexcept
Definition: EventRange.cc:117
EventNumber_t begin() const noexcept
Definition: EventRange.cc:105
static bool are_valid(EventRange const &l, EventRange const &r) noexcept
Definition: EventRange.cc:44
bool is_subset(EventRange const &other) const noexcept
Definition: EventRange.cc:170
EventRange & operator=(EventRange const &) noexcept
SubRunNumber_t subRun() const noexcept
Definition: EventRange.cc:93
IDNumber_t< Level::Event > EventNumber_t
Definition: IDNumber.h:118
bool is_superset(EventRange const &other) const noexcept
Definition: EventRange.cc:180
bool merge(EventRange const &other)
Definition: EventRange.cc:199
bool is_adjacent(EventRange const &other) const noexcept
Definition: EventRange.cc:152
static QCString * s
Definition: config.cpp:1042
bool operator<(EventRange const &other) const noexcept
Definition: EventRange.cc:68
bool is_overlapping(EventRange const &other) const noexcept
Definition: EventRange.cc:190