Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
art::RunID Class Reference

#include <RunID.h>

Classes

struct  FlushFlag
 

Public Member Functions

constexpr RunID () noexcept
 
 RunID (RunNumber_t i)
 
RunNumber_t run () const
 
bool isValid () const
 
bool isFlush () const
 
RunID next () const
 
RunID previous () const
 
bool operator== (RunID const &other) const
 
bool operator!= (RunID const &other) const
 
bool operator< (RunID const &other) const
 
bool operator<= (RunID const &other) const
 
bool operator> (RunID const &other) const
 
bool operator>= (RunID const &other) const
 

Static Public Member Functions

static RunID maxRun ()
 
static RunID firstRun ()
 
static constexpr RunID flushRun () noexcept
 

Private Member Functions

constexpr RunID (FlushFlag) noexcept
 
RunNumber_t inRangeOrInvalid (RunNumber_t r)
 

Private Attributes

RunNumber_t run_
 

Friends

std::ostream & operator<< (std::ostream &os, RunID const &iID)
 

Detailed Description

Definition at line 21 of file RunID.h.

Constructor & Destructor Documentation

constexpr art::RunID::RunID ( )
inlinenoexcept

Definition at line 57 of file RunID.h.

59 {}
static constexpr type invalid() noexcept
Definition: IDNumber.h:82
RunNumber_t run_
Definition: RunID.h:54
art::RunID::RunID ( RunNumber_t  i)
inlineexplicit

Definition at line 61 of file RunID.h.

61 : run_(inRangeOrInvalid(i)) {}
RunNumber_t inRangeOrInvalid(RunNumber_t r)
Definition: RunID.h:168
RunNumber_t run_
Definition: RunID.h:54
constexpr art::RunID::RunID ( FlushFlag  )
inlineexplicitprivatenoexcept

Definition at line 181 of file RunID.h.

183 {}
static constexpr type flush_value() noexcept
Definition: IDNumber.h:92
RunNumber_t run_
Definition: RunID.h:54

Member Function Documentation

art::RunID art::RunID::firstRun ( )
inlinestatic

Definition at line 116 of file RunID.h.

117 {
119 }
static constexpr type first() noexcept
Definition: IDNumber.h:102
constexpr RunID() noexcept
Definition: RunID.h:57
constexpr art::RunID art::RunID::flushRun ( )
inlinestaticnoexcept

Definition at line 122 of file RunID.h.

123 {
124  return RunID(FlushFlag());
125 }
constexpr RunID() noexcept
Definition: RunID.h:57
art::RunNumber_t art::RunID::inRangeOrInvalid ( RunNumber_t  r)
inlineprivate

Definition at line 168 of file RunID.h.

169 {
170  if (r == IDNumber<Level::Run>::invalid() ||
173  return r;
174  } else {
176  << "Attempt to construct RunID with an invalid number.\n"
177  << "Maybe you want RunID::flushRun()?\n";
178  }
179 }
static constexpr type first() noexcept
Definition: IDNumber.h:102
static constexpr type max_natural() noexcept
Definition: IDNumber.h:97
static constexpr type invalid() noexcept
Definition: IDNumber.h:82
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
bool art::RunID::isFlush ( ) const
inline

Definition at line 76 of file RunID.h.

77 {
79 }
static constexpr type flush_value() noexcept
Definition: IDNumber.h:92
RunNumber_t run_
Definition: RunID.h:54
bool art::RunID::isValid ( ) const
inline

Definition at line 70 of file RunID.h.

71 {
72  return (run_ != IDNumber<Level::Run>::invalid());
73 }
static constexpr type invalid() noexcept
Definition: IDNumber.h:82
RunNumber_t run_
Definition: RunID.h:54
art::RunID art::RunID::maxRun ( )
inlinestatic

Definition at line 110 of file RunID.h.

111 {
113 }
static constexpr type max_natural() noexcept
Definition: IDNumber.h:97
constexpr RunID() noexcept
Definition: RunID.h:57
art::RunID art::RunID::next ( ) const
inline

Definition at line 84 of file RunID.h.

85 {
86  if (!isValid()) {
88  << "cannot increment invalid run number.";
89  } else if (run_ == IDNumber<Level::Run>::max_natural()) {
91  << "cannot increment maximum run number.";
92  }
93  return RunID(run_ + 1);
94 }
static constexpr type max_natural() noexcept
Definition: IDNumber.h:97
RunNumber_t run_
Definition: RunID.h:54
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
bool isValid() const
Definition: RunID.h:70
constexpr RunID() noexcept
Definition: RunID.h:57
bool art::RunID::operator!= ( RunID const &  other) const
inline

Definition at line 135 of file RunID.h.

136 {
137  return !(*this == other);
138 }
bool art::RunID::operator< ( RunID const &  other) const
inline

Definition at line 143 of file RunID.h.

144 {
145  static SortInvalidFirst<RunNumber_t> op(IDNumber<Level::Run>::invalid());
146  return op(run_, other.run_);
147 }
static constexpr type invalid() noexcept
Definition: IDNumber.h:82
RunNumber_t run_
Definition: RunID.h:54
bool art::RunID::operator<= ( RunID const &  other) const
inline

Definition at line 150 of file RunID.h.

151 {
152  return (*this < other) || (*this == other);
153 }
bool art::RunID::operator== ( RunID const &  other) const
inline

Definition at line 129 of file RunID.h.

130 {
131  return other.run_ == run_;
132 }
RunNumber_t run_
Definition: RunID.h:54
bool art::RunID::operator> ( RunID const &  other) const
inline

Definition at line 156 of file RunID.h.

157 {
158  return (other < *this);
159 }
bool art::RunID::operator>= ( RunID const &  other) const
inline

Definition at line 162 of file RunID.h.

163 {
164  return !(*this < other);
165 }
art::RunID art::RunID::previous ( ) const
inline

Definition at line 97 of file RunID.h.

98 {
99  if (!isValid()) {
101  << "cannot decrement minimum run number.";
102  } else if (run_ == IDNumber<Level::Run>::max_natural()) {
104  << "cannot increment maximum run number.";
105  }
106  return RunID(run_ - 1);
107 }
static constexpr type max_natural() noexcept
Definition: IDNumber.h:97
RunNumber_t run_
Definition: RunID.h:54
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
bool isValid() const
Definition: RunID.h:70
constexpr RunID() noexcept
Definition: RunID.h:57
art::RunNumber_t art::RunID::run ( ) const
inline

Definition at line 64 of file RunID.h.

65 {
66  return run_;
67 }
RunNumber_t run_
Definition: RunID.h:54

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
RunID const &  iID 
)
friend

Member Data Documentation

RunNumber_t art::RunID::run_
private

Definition at line 54 of file RunID.h.


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