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

#include "ProcessingLimits.h"

Classes

struct  Config
 

Public Member Functions

 ProcessingLimits (Config const &config, std::function< input::ItemType()> nextItemType)
 
input::ItemType nextItemType ()
 
InputSource::ProcessingMode processingMode () const noexcept
 
int remainingEvents () const noexcept
 
int remainingSubRuns () const noexcept
 
void update (EventID const &id)
 
void update (SubRunID const &id)
 

Private Member Functions

bool allowed_ (input::ItemType) const noexcept
 

Private Attributes

InputSource::ProcessingMode processingMode_
 
int remainingEvents_
 
int remainingSubRuns_
 
int reportFrequency_
 
int numberOfEventsRead_ {}
 
std::function< input::ItemType()> nextItemType_
 

Detailed Description

Definition at line 11 of file ProcessingLimits.h.

Constructor & Destructor Documentation

art::ProcessingLimits::ProcessingLimits ( Config const &  config,
std::function< input::ItemType()>  nextItemType 
)

Definition at line 9 of file ProcessingLimits.cc.

References art::errors::Configuration, art::ProcessingLimits::Config::maxEvents, art::ProcessingLimits::Config::maxSubRuns, art::InputSource::mode(), nextItemType(), nextItemType_, art::ProcessingLimits::Config::processingMode, remainingEvents_, remainingSubRuns_, art::ProcessingLimits::Config::reportFrequency, and reportFrequency_.

12  : processingMode_{InputSource::mode(config.processingMode())}
13  , remainingEvents_{config.maxEvents()}
14  , remainingSubRuns_{config.maxSubRuns()}
15  , reportFrequency_{config.reportFrequency()}
16  , nextItemType_{std::move(nextItemType)}
17  {
18  if (reportFrequency_ < 0) {
20  << "reportFrequency has a negative value, which is not meaningful.";
21  }
22  }
InputSource::ProcessingMode processingMode_
input::ItemType nextItemType()
std::function< input::ItemType()> nextItemType_
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
static ProcessingMode mode(std::string const &modeString)
Definition: InputSource.cc:9

Member Function Documentation

bool art::ProcessingLimits::allowed_ ( input::ItemType  item_type) const
privatenoexcept

Definition at line 77 of file ProcessingLimits.cc.

References art::input::IsEvent, art::input::IsSubRun, processingMode_, art::InputSource::RunsAndSubRuns, and art::InputSource::RunsSubRunsAndEvents.

Referenced by nextItemType().

78  {
80  return true;
81  }
82 
83  // Events no longer allowed
84  if (item_type == input::IsEvent) {
85  return false;
86  }
88  return true;
89  }
90 
91  // SubRuns no longer allowed
92  return item_type != input::IsSubRun;
93  }
InputSource::ProcessingMode processingMode_
input::ItemType art::ProcessingLimits::nextItemType ( )

Definition at line 25 of file ProcessingLimits.cc.

References allowed_(), art::input::IsStop, nextItemType_, remainingEvents_, and remainingSubRuns_.

Referenced by art::EmptyEvent::nextItemType(), and ProcessingLimits().

26  {
27  if (remainingEvents_ == 0 || remainingSubRuns_ == 0) {
28  return input::IsStop;
29  }
30 
31  auto item_type = nextItemType_();
32  while (not allowed_(item_type)) {
33  item_type = nextItemType_();
34  }
35  return item_type;
36  }
bool allowed_(input::ItemType) const noexcept
std::function< input::ItemType()> nextItemType_
InputSource::ProcessingMode art::ProcessingLimits::processingMode ( ) const
noexcept

Definition at line 39 of file ProcessingLimits.cc.

References processingMode_.

40  {
41  return processingMode_;
42  }
InputSource::ProcessingMode processingMode_
int art::ProcessingLimits::remainingEvents ( ) const
noexcept

Definition at line 45 of file ProcessingLimits.cc.

References remainingEvents_.

46  {
47  return remainingEvents_;
48  }
int art::ProcessingLimits::remainingSubRuns ( ) const
noexcept

Definition at line 51 of file ProcessingLimits.cc.

References remainingSubRuns_.

52  {
53  return remainingSubRuns_;
54  }
void art::ProcessingLimits::update ( EventID const &  id)
void art::ProcessingLimits::update ( SubRunID const &  id)

Definition at line 57 of file ProcessingLimits.cc.

References remainingSubRuns_.

58  {
59  if (remainingSubRuns_ > 0) {
61  }
62  }

Member Data Documentation

std::function<input::ItemType()> art::ProcessingLimits::nextItemType_
private

Definition at line 52 of file ProcessingLimits.h.

Referenced by nextItemType(), and ProcessingLimits().

int art::ProcessingLimits::numberOfEventsRead_ {}
private

Definition at line 51 of file ProcessingLimits.h.

Referenced by update().

InputSource::ProcessingMode art::ProcessingLimits::processingMode_
private
Initial value:

Definition at line 46 of file ProcessingLimits.h.

Referenced by allowed_(), and processingMode().

int art::ProcessingLimits::remainingEvents_
private

Definition at line 48 of file ProcessingLimits.h.

Referenced by nextItemType(), ProcessingLimits(), remainingEvents(), and update().

int art::ProcessingLimits::remainingSubRuns_
private

Definition at line 49 of file ProcessingLimits.h.

Referenced by nextItemType(), ProcessingLimits(), remainingSubRuns(), and update().

int art::ProcessingLimits::reportFrequency_
private

Definition at line 50 of file ProcessingLimits.h.

Referenced by ProcessingLimits(), and update().


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