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

Referenced by firstRun(), flushRun(), maxRun(), next(), and previous().

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.

References RunID().

Referenced by art::EmptyEvent::EmptyEvent(), and art::SubRunID::firstSubRun().

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.

References RunID().

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.

References art::errors::InvalidNumber, and r.

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 }
TRandom r
Definition: spectrum.C:23
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.

References run_.

Referenced by art::EventIDMatcher::match(), and art::operator<<().

77 {
79 }
static constexpr type flush_value() noexcept
Definition: IDNumber.h:92
RunNumber_t run_
Definition: RunID.h:54
art::RunID art::RunID::maxRun ( )
inlinestatic

Definition at line 110 of file RunID.h.

References RunID().

Referenced by art::SubRunID::maxSubRun().

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.

References art::errors::InvalidNumber, isValid(), run_, and RunID().

Referenced by art::SubRunID::nextRun().

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.

References fhicl::other.

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

Definition at line 143 of file RunID.h.

References run_.

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.

References fhicl::other.

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.

References run_.

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.

References fhicl::other.

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

Definition at line 97 of file RunID.h.

References art::errors::InvalidNumber, isValid(), run_, and RunID().

Referenced by art::SubRunID::previousRun().

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

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.

Referenced by isFlush(), isValid(), next(), operator<(), art::operator<<(), operator==(), previous(), and run().


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