LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ScheduleID.cc
Go to the documentation of this file.
1 // vim: set sw=2 expandtab :
3 
4 #include <ostream>
5 #include <stdexcept>
6 
7 using namespace std;
8 
9 namespace art {
10 
11  ScheduleID::ScheduleID(id_type const id)
12  {
13  // No need to test against min_id_() since that is the smallest
14  // possible value already.
15  if (id > max_id_()) {
16  // Somebody passed us invalid_id_().
17  throw out_of_range("ScheduleID: Invalid initializer.");
18  }
19  id_ = id;
20  }
21 
23  ScheduleID::next() const
24  {
25  return ScheduleID(id_ + 1);
26  }
27 
28  bool
29  ScheduleID::operator==(ScheduleID const& rhs) const noexcept
30  {
31  return id_ == rhs.id_;
32  }
33 
34  bool
35  ScheduleID::operator<(ScheduleID const& rhs) const noexcept
36  {
37  return id_ < rhs.id_;
38  }
39 
40  bool
41  operator!=(ScheduleID const left, ScheduleID const right) noexcept
42  {
43  return !(left == right);
44  }
45 
46  bool
47  operator<=(ScheduleID const left, ScheduleID const right) noexcept
48  {
49  return ((left < right) || (left == right));
50  }
51 
52  bool
53  operator>(ScheduleID const left, ScheduleID const right) noexcept
54  {
55  return !(left <= right);
56  }
57 
58  bool
59  operator>=(ScheduleID const left, ScheduleID const right) noexcept
60  {
61  return !(left < right);
62  }
63 
64  ostream&
65  operator<<(ostream& os, ScheduleID const sid)
66  {
67  return os << sid.id();
68  }
69 } // namespace art
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:102
bool operator>(ScheduleID const left, ScheduleID const right) noexcept
Definition: ScheduleID.cc:53
constexpr bool operator<(CryostatID const &a, CryostatID const &b)
Order cryostats with increasing ID.
Definition: geo_types.h:692
STL namespace.
bool operator!=(ScheduleID const left, ScheduleID const right) noexcept
Definition: ScheduleID.cc:41
bool operator<=(ScheduleID const left, ScheduleID const right) noexcept
Definition: ScheduleID.cc:47
uint16_t id_type
Definition: ScheduleID.h:22
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:94
constexpr id_type id() const noexcept
Definition: ScheduleID.h:77
Definition: MVAAlg.h:12
bool operator>=(ScheduleID const left, ScheduleID const right) noexcept
Definition: ScheduleID.cc:59
bool operator==(infinite_endcount_iterator< T > const &, count_iterator< T > const &)
Definition: counter.h:278
ostream & operator<<(ostream &os, ScheduleID const sid)
Definition: ScheduleID.cc:65