Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
art::EventRange Class Reference

#include <EventRange.h>

Public Member Functions

 ~EventRange () noexcept
 
 EventRange () noexcept
 
 EventRange (SubRunNumber_t s, EventNumber_t begin, EventNumber_t end)
 
 EventRange (EventRange const &) noexcept
 
 EventRange (EventRange &&) noexcept
 
EventRangeoperator= (EventRange const &) noexcept
 
EventRangeoperator= (EventRange &&) noexcept
 
bool operator< (EventRange const &other) const noexcept
 
bool operator== (EventRange const &other) const noexcept
 
bool operator!= (EventRange const &other) const noexcept
 
SubRunNumber_t subRun () const noexcept
 
EventNumber_t begin () const noexcept
 
EventNumber_t end () const noexcept
 
unsigned long long size () const noexcept
 
bool empty () const noexcept
 
bool is_valid () const noexcept
 
bool is_full_subRun () const noexcept
 
bool contains (SubRunNumber_t s, EventNumber_t e) const noexcept
 
bool is_same (EventRange const &other) const noexcept
 
bool is_adjacent (EventRange const &other) const noexcept
 
bool is_disjoint (EventRange const &other) const noexcept
 
bool is_subset (EventRange const &other) const noexcept
 
bool is_superset (EventRange const &other) const noexcept
 
bool is_overlapping (EventRange const &other) const noexcept
 
bool merge (EventRange const &other)
 
void set_end (EventNumber_t const e)
 

Static Public Member Functions

static EventRange invalid () noexcept
 
static EventRange forSubRun (SubRunNumber_t s) noexcept
 
static bool are_valid (EventRange const &l, EventRange const &r) noexcept
 

Private Member Functions

void require_not_full_SubRun () const
 

Private Attributes

SubRunNumber_t subRun_ {IDNumber<Level::SubRun>::invalid()}
 
EventNumber_t begin_ {IDNumber<Level::Event>::invalid()}
 
EventNumber_t end_ {IDNumber<Level::Event>::invalid()}
 

Detailed Description

Definition at line 17 of file EventRange.h.

Constructor & Destructor Documentation

art::EventRange::~EventRange ( )
defaultnoexcept
art::EventRange::EventRange ( )
explicitdefaultnoexcept
art::EventRange::EventRange ( SubRunNumber_t  s,
EventNumber_t  begin,
EventNumber_t  end 
)
explicit

Definition at line 52 of file EventRange.cc.

55  : subRun_{s}, begin_{b}, end_{e}
56  {
57  require_ordering(begin_, end_);
58  }
SubRunNumber_t subRun_
Definition: EventRange.h:71
const double e
EventNumber_t end_
Definition: EventRange.h:73
EventNumber_t begin_
Definition: EventRange.h:72
static bool * b
Definition: config.cpp:1043
static QCString * s
Definition: config.cpp:1042
art::EventRange::EventRange ( EventRange const &  )
defaultnoexcept
art::EventRange::EventRange ( EventRange &&  )
defaultnoexcept

Member Function Documentation

bool art::EventRange::are_valid ( EventRange const &  l,
EventRange const &  r 
)
staticnoexcept

Definition at line 44 of file EventRange.cc.

45  {
46  return l.is_valid() && r.is_valid();
47  }
static QStrList * l
Definition: config.cpp:1044
EventNumber_t art::EventRange::begin ( ) const
noexcept

Definition at line 105 of file EventRange.cc.

106  {
107  return begin_;
108  }
EventNumber_t begin_
Definition: EventRange.h:72
bool art::EventRange::contains ( SubRunNumber_t  s,
EventNumber_t  e 
) const
noexcept

Definition at line 136 of file EventRange.cc.

138  {
139  return (subRun_ == s) && (e >= begin_) && (e < end_);
140  }
SubRunNumber_t subRun_
Definition: EventRange.h:71
const double e
EventNumber_t end_
Definition: EventRange.h:73
EventNumber_t begin_
Definition: EventRange.h:72
static QCString * s
Definition: config.cpp:1042
bool art::EventRange::empty ( ) const
noexcept

Definition at line 99 of file EventRange.cc.

100  {
101  return begin_ == end_;
102  }
EventNumber_t end_
Definition: EventRange.h:73
EventNumber_t begin_
Definition: EventRange.h:72
EventNumber_t art::EventRange::end ( ) const
noexcept

Definition at line 111 of file EventRange.cc.

112  {
113  return end_;
114  }
EventNumber_t end_
Definition: EventRange.h:73
EventRange art::EventRange::forSubRun ( SubRunNumber_t  s)
staticnoexcept

Definition at line 37 of file EventRange.cc.

38  {
40  }
static constexpr type invalid() noexcept
Definition: IDNumber.h:17
EventRange() noexcept
static QCString * s
Definition: config.cpp:1042
EventRange art::EventRange::invalid ( )
staticnoexcept

Definition at line 30 of file EventRange.cc.

31  {
32  return EventRange{};
33  }
EventRange() noexcept
bool art::EventRange::is_adjacent ( EventRange const &  other) const
noexcept

Definition at line 152 of file EventRange.cc.

153  {
154  if (!are_valid(*this, other)) {
155  return false;
156  }
157  return (subRun_ == other.subRun_) && (end_ == other.begin_);
158  }
SubRunNumber_t subRun_
Definition: EventRange.h:71
EventNumber_t end_
Definition: EventRange.h:73
static bool are_valid(EventRange const &l, EventRange const &r) noexcept
Definition: EventRange.cc:44
bool art::EventRange::is_disjoint ( EventRange const &  other) const
noexcept

Definition at line 161 of file EventRange.cc.

162  {
163  if (!are_valid(*this, other)) {
164  return false;
165  }
166  return (subRun_ == other.subRun_) ? (end_ <= other.begin_) : true;
167  }
SubRunNumber_t subRun_
Definition: EventRange.h:71
EventNumber_t end_
Definition: EventRange.h:73
static bool are_valid(EventRange const &l, EventRange const &r) noexcept
Definition: EventRange.cc:44
bool art::EventRange::is_full_subRun ( ) const
noexcept

Definition at line 129 of file EventRange.cc.

130  {
133  }
static constexpr type invalid() noexcept
Definition: IDNumber.h:17
SubRunNumber_t subRun_
Definition: EventRange.h:71
constexpr bool is_valid(IDNumber_t< L > const id) noexcept
Definition: IDNumber.h:113
EventNumber_t end_
Definition: EventRange.h:73
EventNumber_t begin_
Definition: EventRange.h:72
bool art::EventRange::is_overlapping ( EventRange const &  other) const
noexcept

Definition at line 190 of file EventRange.cc.

191  {
192  if (!are_valid(*this, other)) {
193  return false;
194  }
195  return !is_disjoint(other) && !is_subset(other) && !is_superset(other);
196  }
bool is_disjoint(EventRange const &other) const noexcept
Definition: EventRange.cc:161
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
bool is_superset(EventRange const &other) const noexcept
Definition: EventRange.cc:180
bool art::EventRange::is_same ( EventRange const &  other) const
noexcept

Definition at line 143 of file EventRange.cc.

144  {
145  if (!are_valid(*this, other)) {
146  return false;
147  }
148  return operator==(other);
149  }
bool operator==(EventRange const &other) const noexcept
Definition: EventRange.cc:80
static bool are_valid(EventRange const &l, EventRange const &r) noexcept
Definition: EventRange.cc:44
bool art::EventRange::is_subset ( EventRange const &  other) const
noexcept

Definition at line 170 of file EventRange.cc.

171  {
172  if (!are_valid(*this, other)) {
173  return false;
174  }
175  return (subRun_ == other.subRun_) && (begin_ >= other.begin_) &&
176  (end_ <= other.end_);
177  }
SubRunNumber_t subRun_
Definition: EventRange.h:71
EventNumber_t end_
Definition: EventRange.h:73
EventNumber_t begin_
Definition: EventRange.h:72
static bool are_valid(EventRange const &l, EventRange const &r) noexcept
Definition: EventRange.cc:44
bool art::EventRange::is_superset ( EventRange const &  other) const
noexcept

Definition at line 180 of file EventRange.cc.

181  {
182  if (!are_valid(*this, other)) {
183  return false;
184  }
185  return (subRun_ == other.subRun_) && (begin_ <= other.begin_) &&
186  (end_ >= other.end_);
187  }
SubRunNumber_t subRun_
Definition: EventRange.h:71
EventNumber_t end_
Definition: EventRange.h:73
EventNumber_t begin_
Definition: EventRange.h:72
static bool are_valid(EventRange const &l, EventRange const &r) noexcept
Definition: EventRange.cc:44
bool art::EventRange::is_valid ( ) const
noexcept

Definition at line 117 of file EventRange.cc.

118  {
120  }
SubRunNumber_t subRun_
Definition: EventRange.h:71
constexpr bool is_valid(IDNumber_t< L > const id) noexcept
Definition: IDNumber.h:113
bool art::EventRange::merge ( EventRange const &  other)

Definition at line 199 of file EventRange.cc.

200  {
202  if (!are_valid(*this, other)) {
203  return false;
204  }
205  bool const mergeable = is_adjacent(other);
206  if (mergeable) {
207  end_ = other.end_;
208  }
209  return mergeable;
210  }
void require_not_full_SubRun() const
Definition: EventRange.cc:221
EventNumber_t end_
Definition: EventRange.h:73
static bool are_valid(EventRange const &l, EventRange const &r) noexcept
Definition: EventRange.cc:44
bool is_adjacent(EventRange const &other) const noexcept
Definition: EventRange.cc:152
bool art::EventRange::operator!= ( EventRange const &  other) const
noexcept

Definition at line 87 of file EventRange.cc.

88  {
89  return !operator==(other);
90  }
bool operator==(EventRange const &other) const noexcept
Definition: EventRange.cc:80
bool art::EventRange::operator< ( EventRange const &  other) const
noexcept

Definition at line 68 of file EventRange.cc.

69  {
70  if (subRun_ == other.subRun_) {
71  if (begin_ == other.begin_) {
72  return end_ < other.end_;
73  }
74  return begin_ < other.begin_;
75  }
76  return subRun_ < other.subRun_;
77  }
SubRunNumber_t subRun_
Definition: EventRange.h:71
EventNumber_t end_
Definition: EventRange.h:73
EventNumber_t begin_
Definition: EventRange.h:72
EventRange & art::EventRange::operator= ( EventRange const &  )
defaultnoexcept
EventRange & art::EventRange::operator= ( EventRange &&  )
defaultnoexcept
bool art::EventRange::operator== ( EventRange const &  other) const
noexcept

Definition at line 80 of file EventRange.cc.

81  {
82  return (subRun_ == other.subRun_) && (begin_ == other.begin_) &&
83  (end_ == other.end_);
84  }
SubRunNumber_t subRun_
Definition: EventRange.h:71
EventNumber_t end_
Definition: EventRange.h:73
EventNumber_t begin_
Definition: EventRange.h:72
void art::EventRange::require_not_full_SubRun ( ) const
private

Definition at line 221 of file EventRange.cc.

222  {
223  if (is_full_subRun()) {
224  throw Exception{errors::LogicError} << "\nAn EventRange created using "
225  "EventRange::forSubRun cannot be "
226  "modified.\n";
227  }
228  }
bool is_full_subRun() const noexcept
Definition: EventRange.cc:129
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
void art::EventRange::set_end ( EventNumber_t const  e)

Definition at line 213 of file EventRange.cc.

214  {
216  require_ordering(begin_, e);
217  end_ = e;
218  }
void require_not_full_SubRun() const
Definition: EventRange.cc:221
const double e
EventNumber_t end_
Definition: EventRange.h:73
EventNumber_t begin_
Definition: EventRange.h:72
unsigned long long art::EventRange::size ( ) const
noexcept

Definition at line 123 of file EventRange.cc.

124  {
125  return is_valid() ? (end_ - begin_) : -1ull;
126  }
EventNumber_t end_
Definition: EventRange.h:73
EventNumber_t begin_
Definition: EventRange.h:72
bool is_valid() const noexcept
Definition: EventRange.cc:117
SubRunNumber_t art::EventRange::subRun ( ) const
noexcept

Definition at line 93 of file EventRange.cc.

94  {
95  return subRun_;
96  }
SubRunNumber_t subRun_
Definition: EventRange.h:71

Member Data Documentation

EventNumber_t art::EventRange::begin_ {IDNumber<Level::Event>::invalid()}
private

Definition at line 72 of file EventRange.h.

EventNumber_t art::EventRange::end_ {IDNumber<Level::Event>::invalid()}
private

Definition at line 73 of file EventRange.h.

SubRunNumber_t art::EventRange::subRun_ {IDNumber<Level::SubRun>::invalid()}
private

Definition at line 71 of file EventRange.h.


The documentation for this class was generated from the following files: