LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
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

Referenced by EventRange().

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

Definition at line 52 of file EventRange.cc.

References begin_, e, end_, EventRange(), and operator=().

55  : subRun_{s}, begin_{b}, end_{e}
56  {
57  require_ordering(begin_, end_);
58  }
SubRunNumber_t subRun_
Definition: EventRange.h:71
EventNumber_t end_
Definition: EventRange.h:73
EventNumber_t begin_
Definition: EventRange.h:72
Float_t e
Definition: plot.C:35
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.

References r.

Referenced by is_adjacent(), is_disjoint(), is_overlapping(), is_same(), is_subset(), is_superset(), and merge().

45  {
46  return l.is_valid() && r.is_valid();
47  }
TRandom r
Definition: spectrum.C:23
EventNumber_t art::EventRange::begin ( ) const
noexcept

Definition at line 105 of file EventRange.cc.

References begin_.

Referenced by art::operator<<().

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.

References begin_, e, end_, and subRun_.

Referenced by art::ClosedRangeSetHandler::do_update().

138  {
139  return (subRun_ == s) && (e >= begin_) && (e < end_);
140  }
SubRunNumber_t subRun_
Definition: EventRange.h:71
EventNumber_t end_
Definition: EventRange.h:73
EventNumber_t begin_
Definition: EventRange.h:72
Float_t e
Definition: plot.C:35
bool art::EventRange::empty ( ) const
noexcept

Definition at line 99 of file EventRange.cc.

References begin_, and end_.

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 ( void  ) const
noexcept

Definition at line 111 of file EventRange.cc.

References end_.

Referenced by art::operator<<(), and art::RangeSet::update().

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
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.

References are_valid(), end_, fhicl::other, and subRun_.

Referenced by art::RangeSet::collapse(), and merge().

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.

References are_valid(), end_, fhicl::other, and subRun_.

Referenced by is_overlapping().

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.

References begin_, end_, art::is_valid(), and subRun_.

Referenced by art::operator<<(), and require_not_full_SubRun().

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.

References are_valid(), is_disjoint(), is_subset(), is_superset(), and fhicl::other.

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.

References are_valid(), operator==(), and fhicl::other.

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.

References are_valid(), begin_, end_, fhicl::other, and subRun_.

Referenced by is_overlapping().

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.

References are_valid(), begin_, end_, fhicl::other, and subRun_.

Referenced by is_overlapping().

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.

References art::is_valid(), and subRun_.

Referenced by size().

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.

References are_valid(), end_, is_adjacent(), and require_not_full_SubRun().

Referenced by art::RangeSet::collapse().

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.

References operator==(), and fhicl::other.

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.

References begin_, end_, fhicl::other, and subRun_.

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

Referenced by EventRange().

EventRange & art::EventRange::operator= ( EventRange &&  )
defaultnoexcept
bool art::EventRange::operator== ( EventRange const &  other) const
noexcept

Definition at line 80 of file EventRange.cc.

References begin_, end_, fhicl::other, and subRun_.

Referenced by is_same(), and operator!=().

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.

References is_full_subRun(), and art::errors::LogicError.

Referenced by merge(), and set_end().

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.

References begin_, e, end_, and require_not_full_SubRun().

Referenced by art::RangeSet::update().

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

Definition at line 123 of file EventRange.cc.

References begin_, end_, and is_valid().

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.

References subRun_.

Referenced by art::operator<<(), and art::RangeSet::update().

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

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