LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
art::SubRunID Class Reference

#include "SubRunID.h"

Classes

struct  FlushFlag
 

Public Member Functions

constexpr SubRunID () noexcept
 
 SubRunID (RunID rID, SubRunNumber_t srID)
 
 SubRunID (RunNumber_t rID, SubRunNumber_t srID)
 
RunID const & runID () const
 
RunNumber_t run () const
 
SubRunNumber_t subRun () const
 
bool isValid () const
 
bool isFlush () const
 
SubRunID next () const
 
SubRunID nextRun () const
 
SubRunID previous () const
 
SubRunID previousRun () const
 
bool operator== (SubRunID const &other) const
 
bool operator!= (SubRunID const &other) const
 
bool operator< (SubRunID const &other) const
 
bool operator<= (SubRunID const &other) const
 
bool operator> (SubRunID const &other) const
 
bool operator>= (SubRunID const &other) const
 

Static Public Member Functions

static SubRunID maxSubRun ()
 
static SubRunID firstSubRun ()
 
static SubRunID firstSubRun (RunID const &rID)
 
static SubRunID invalidSubRun (RunID const &rID)
 
static constexpr SubRunID flushSubRun () noexcept
 
static SubRunID flushSubRun (RunID const &rID)
 

Private Member Functions

constexpr SubRunID (FlushFlag) noexcept
 
 SubRunID (RunID rID, FlushFlag)
 
SubRunNumber_t inRangeOrInvalid (SubRunNumber_t sr)
 
void checkSane ()
 

Private Attributes

RunID run_
 
SubRunNumber_t subRun_
 

Friends

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

Detailed Description

Definition at line 19 of file SubRunID.h.

Constructor & Destructor Documentation

constexpr art::SubRunID::SubRunID ( )
inlinenoexcept

Definition at line 68 of file SubRunID.h.

Referenced by next(), and previous().

70 {}
RunID run_
Definition: SubRunID.h:64
SubRunNumber_t subRun_
Definition: SubRunID.h:65
static constexpr type invalid() noexcept
Definition: IDNumber.h:52
art::SubRunID::SubRunID ( RunID  rID,
SubRunNumber_t  srID 
)
inline

Definition at line 235 of file SubRunID.h.

References checkSane().

236  : run_(std::move(rID)), subRun_(inRangeOrInvalid(srID))
237 {
238  checkSane();
239 }
RunID run_
Definition: SubRunID.h:64
void checkSane()
Definition: SubRunID.h:253
SubRunNumber_t subRun_
Definition: SubRunID.h:65
SubRunNumber_t inRangeOrInvalid(SubRunNumber_t sr)
Definition: SubRunID.h:242
art::SubRunID::SubRunID ( RunNumber_t  rID,
SubRunNumber_t  srID 
)
inline

Definition at line 72 of file SubRunID.h.

References checkSane().

73  : run_(rID), subRun_(inRangeOrInvalid(srID))
74 {
75  checkSane();
76 }
RunID run_
Definition: SubRunID.h:64
void checkSane()
Definition: SubRunID.h:253
SubRunNumber_t subRun_
Definition: SubRunID.h:65
SubRunNumber_t inRangeOrInvalid(SubRunNumber_t sr)
Definition: SubRunID.h:242
constexpr art::SubRunID::SubRunID ( FlushFlag  )
inlineexplicitprivatenoexcept

Definition at line 227 of file SubRunID.h.

229 {}
RunID run_
Definition: SubRunID.h:64
static constexpr RunID flushRun() noexcept
Definition: RunID.h:122
SubRunNumber_t subRun_
Definition: SubRunID.h:65
static constexpr type flush_value() noexcept
Definition: IDNumber.h:62
art::SubRunID::SubRunID ( RunID  rID,
FlushFlag   
)
inlineprivate

Definition at line 231 of file SubRunID.h.

233 {}
RunID run_
Definition: SubRunID.h:64
SubRunNumber_t subRun_
Definition: SubRunID.h:65
static constexpr type flush_value() noexcept
Definition: IDNumber.h:62

Member Function Documentation

void art::SubRunID::checkSane ( )
inlineprivate

Definition at line 253 of file SubRunID.h.

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

Referenced by SubRunID().

254 {
255  if (isValid() && !run_.isValid()) {
257  << "SubRunID is not meaningful with valid subRun and invalid Run.\n";
258  }
259 }
bool isValid() const
Definition: SubRunID.h:97
RunID run_
Definition: SubRunID.h:64
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
bool isValid() const
Definition: RunID.h:70
art::SubRunID art::SubRunID::firstSubRun ( )
inlinestatic

Definition at line 153 of file SubRunID.h.

References art::RunID::firstRun().

Referenced by art::EmptyEvent::EmptyEvent(), art::FileIndex::findEventForUnspecifiedSubRun(), and art::EventID::firstEvent().

154 {
156 }
static constexpr type first() noexcept
Definition: IDNumber.h:72
constexpr SubRunID() noexcept
Definition: SubRunID.h:68
static RunID firstRun()
Definition: RunID.h:116
art::SubRunID art::SubRunID::firstSubRun ( RunID const &  rID)
inlinestatic

Definition at line 159 of file SubRunID.h.

160 {
162 }
static constexpr type first() noexcept
Definition: IDNumber.h:72
constexpr SubRunID() noexcept
Definition: SubRunID.h:68
constexpr art::SubRunID art::SubRunID::flushSubRun ( )
inlinestaticnoexcept

Definition at line 171 of file SubRunID.h.

Referenced by fluxr::PPFXFluxReader::closeCurrentFile().

172 {
173  return SubRunID{FlushFlag()};
174 }
constexpr SubRunID() noexcept
Definition: SubRunID.h:68
art::SubRunID art::SubRunID::flushSubRun ( RunID const &  rID)
inlinestatic

Definition at line 177 of file SubRunID.h.

178 {
179  return SubRunID{rID, FlushFlag()};
180 }
constexpr SubRunID() noexcept
Definition: SubRunID.h:68
art::SubRunNumber_t art::SubRunID::inRangeOrInvalid ( SubRunNumber_t  sr)
inlineprivate

Definition at line 242 of file SubRunID.h.

References art::errors::InvalidNumber.

243 {
246  << "Attempt to construct SubRunID with an invalid number.\n"
247  << "Maybe you want SubRunID::flushSubRun()?\n";
248  }
249  return sr;
250 }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
static constexpr type flush_value() noexcept
Definition: IDNumber.h:62
art::SubRunID art::SubRunID::invalidSubRun ( RunID const &  rID)
inlinestatic

Definition at line 165 of file SubRunID.h.

Referenced by art::Sampled< T >::get(), art::EventID::invalidEvent(), and evdb::EventDisplay::postProcessEvent().

166 {
168 }
constexpr SubRunID() noexcept
Definition: SubRunID.h:68
static constexpr type invalid() noexcept
Definition: IDNumber.h:52
bool art::SubRunID::isFlush ( ) const
inline

Definition at line 103 of file SubRunID.h.

References subRun_.

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

104 {
106 }
SubRunNumber_t subRun_
Definition: SubRunID.h:65
static constexpr type flush_value() noexcept
Definition: IDNumber.h:62
art::SubRunID art::SubRunID::maxSubRun ( )
inlinestatic

Definition at line 147 of file SubRunID.h.

References art::RunID::maxRun().

Referenced by art::EventID::maxEvent().

148 {
150 }
static RunID maxRun()
Definition: RunID.h:110
static constexpr type max_natural() noexcept
Definition: IDNumber.h:67
constexpr SubRunID() noexcept
Definition: SubRunID.h:68
art::SubRunID art::SubRunID::next ( ) const
inline

Definition at line 111 of file SubRunID.h.

References art::errors::InvalidNumber, isValid(), nextRun(), run_, subRun_, and SubRunID().

Referenced by art::FileIndex::findEventForUnspecifiedSubRun(), and art::EventID::nextSubRun().

112 {
113  if (!isValid()) {
115  << "cannot increment invalid subrun number.";
117  return nextRun();
118  }
119  return SubRunID(run_, subRun_ + 1);
120 }
bool isValid() const
Definition: SubRunID.h:97
RunID run_
Definition: SubRunID.h:64
static constexpr type max_natural() noexcept
Definition: IDNumber.h:67
SubRunID nextRun() const
Definition: SubRunID.h:123
SubRunNumber_t subRun_
Definition: SubRunID.h:65
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
constexpr SubRunID() noexcept
Definition: SubRunID.h:68
art::SubRunID art::SubRunID::nextRun ( ) const
inline

Definition at line 123 of file SubRunID.h.

References art::RunID::next(), and run_.

Referenced by next(), and art::EventID::nextRun().

124 {
126 }
static constexpr type first() noexcept
Definition: IDNumber.h:72
RunID next() const
Definition: RunID.h:84
RunID run_
Definition: SubRunID.h:64
constexpr SubRunID() noexcept
Definition: SubRunID.h:68
bool art::SubRunID::operator!= ( SubRunID const &  other) const
inline

Definition at line 190 of file SubRunID.h.

References fhicl::other.

191 {
192  return !(*this == other);
193 }
bool art::SubRunID::operator< ( SubRunID const &  other) const
inline

Definition at line 198 of file SubRunID.h.

References run_, and subRun_.

199 {
200  constexpr SortInvalidFirst<SubRunNumber_t> op{
202  if (run_ == other.run_) {
203  return op(subRun_, other.subRun_);
204  } else {
205  return run_ < other.run_;
206  }
207 }
RunID run_
Definition: SubRunID.h:64
SubRunNumber_t subRun_
Definition: SubRunID.h:65
static constexpr type invalid() noexcept
Definition: IDNumber.h:52
bool art::SubRunID::operator<= ( SubRunID const &  other) const
inline

Definition at line 210 of file SubRunID.h.

References fhicl::other.

211 {
212  return (*this < other) || (*this == other);
213 }
bool art::SubRunID::operator== ( SubRunID const &  other) const
inline

Definition at line 184 of file SubRunID.h.

References run_, and subRun_.

185 {
186  return other.run_ == run_ && other.subRun_ == subRun_;
187 }
RunID run_
Definition: SubRunID.h:64
SubRunNumber_t subRun_
Definition: SubRunID.h:65
bool art::SubRunID::operator> ( SubRunID const &  other) const
inline

Definition at line 216 of file SubRunID.h.

217 {
218  return (other < *this);
219 }
bool art::SubRunID::operator>= ( SubRunID const &  other) const
inline

Definition at line 222 of file SubRunID.h.

References fhicl::other.

223 {
224  return !(*this < other);
225 }
art::SubRunID art::SubRunID::previous ( ) const
inline

Definition at line 129 of file SubRunID.h.

References art::errors::InvalidNumber, isValid(), previousRun(), run_, subRun_, and SubRunID().

Referenced by art::EventID::previousSubRun().

130 {
131  if (!isValid()) {
133  << "cannot decrement invalid subrun number.";
134  } else if (subRun_ == IDNumber<Level::SubRun>::first()) {
135  return previousRun();
136  }
137  return SubRunID(run_, subRun_ - 1);
138 }
static constexpr type first() noexcept
Definition: IDNumber.h:72
SubRunID previousRun() const
Definition: SubRunID.h:141
bool isValid() const
Definition: SubRunID.h:97
RunID run_
Definition: SubRunID.h:64
SubRunNumber_t subRun_
Definition: SubRunID.h:65
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
constexpr SubRunID() noexcept
Definition: SubRunID.h:68
art::SubRunID art::SubRunID::previousRun ( ) const
inline

Definition at line 141 of file SubRunID.h.

References art::RunID::previous(), and run_.

Referenced by previous(), and art::EventID::previousRun().

142 {
144 }
RunID run_
Definition: SubRunID.h:64
static constexpr type max_natural() noexcept
Definition: IDNumber.h:67
RunID previous() const
Definition: RunID.h:97
constexpr SubRunID() noexcept
Definition: SubRunID.h:68
art::RunID const & art::SubRunID::runID ( ) const
inline

Friends And Related Function Documentation

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

Member Data Documentation

RunID art::SubRunID::run_
private
SubRunNumber_t art::SubRunID::subRun_
private

Definition at line 65 of file SubRunID.h.

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


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