LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
art::RunID Class Reference

#include "RunID.h"

Classes

struct  FlushFlag
 

Public Member Functions

constexpr RunID ()
 
 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 ()
 

Private Member Functions

constexpr RunID (FlushFlag)
 
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 ( )
inline

Definition at line 58 of file RunID.h.

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

static constexpr type invalid()
Definition: IDNumber.h:81
RunNumber_t run_
Definition: RunID.h:55
art::RunID::RunID ( RunNumber_t  i)
inlineexplicit

Definition at line 60 of file RunID.h.

60 : run_(inRangeOrInvalid(i)) {}
RunNumber_t inRangeOrInvalid(RunNumber_t r)
Definition: RunID.h:167
RunNumber_t run_
Definition: RunID.h:55
constexpr art::RunID::RunID ( FlushFlag  )
inlineexplicitprivate

Definition at line 180 of file RunID.h.

182 {}
RunNumber_t run_
Definition: RunID.h:55
static constexpr type flush_value()
Definition: IDNumber.h:91

Member Function Documentation

art::RunID art::RunID::firstRun ( )
inlinestatic
constexpr art::RunID art::RunID::flushRun ( )
inlinestatic

Definition at line 121 of file RunID.h.

References RunID().

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

Definition at line 167 of file RunID.h.

References art::errors::InvalidNumber.

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

Definition at line 75 of file RunID.h.

References run_.

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

76 {
78 }
RunNumber_t run_
Definition: RunID.h:55
static constexpr type flush_value()
Definition: IDNumber.h:91
art::RunID art::RunID::maxRun ( )
inlinestatic

Definition at line 109 of file RunID.h.

References RunID().

Referenced by art::SubRunID::maxSubRun(), and art::RootInputFileSequence::RootInputFileSequence().

110 {
112 }
static constexpr type max_natural()
Definition: IDNumber.h:96
constexpr RunID()
Definition: RunID.h:58
art::RunID art::RunID::next ( ) const
inline

Definition at line 83 of file RunID.h.

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

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

84 {
85  if (!isValid()) {
87  << "cannot increment invalid run number.";
88  } else if (run_ == IDNumber<Level::Run>::max_natural()) {
90  << "cannot increment maximum run number.";
91  }
92  return RunID(run_ + 1);
93 }
static constexpr type max_natural()
Definition: IDNumber.h:96
RunNumber_t run_
Definition: RunID.h:55
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
bool isValid() const
Definition: RunID.h:69
constexpr RunID()
Definition: RunID.h:58
bool art::RunID::operator!= ( RunID const &  other) const
inline

Definition at line 134 of file RunID.h.

References fhicl::other.

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

Definition at line 142 of file RunID.h.

References run_.

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

Definition at line 149 of file RunID.h.

References fhicl::other.

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

Definition at line 128 of file RunID.h.

References run_.

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

Definition at line 155 of file RunID.h.

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

Definition at line 161 of file RunID.h.

References fhicl::other.

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

Definition at line 96 of file RunID.h.

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

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

97 {
98  if (!isValid()) {
100  << "cannot decrement minimum run number.";
101  } else if (run_ == IDNumber<Level::Run>::max_natural()) {
103  << "cannot increment maximum run number.";
104  }
105  return RunID(run_ - 1);
106 }
static constexpr type max_natural()
Definition: IDNumber.h:96
RunNumber_t run_
Definition: RunID.h:55
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
bool isValid() const
Definition: RunID.h:69
constexpr RunID()
Definition: RunID.h:58

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 55 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: