Classes | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
art::DecrepitRelicInputSourceImplementation Class Referenceabstract

#include <DecrepitRelicInputSourceImplementation.h>

Inheritance diagram for art::DecrepitRelicInputSourceImplementation:
art::InputSource art::EmptyEvent

Classes

struct  Config
 

Public Member Functions

 DecrepitRelicInputSourceImplementation (fhicl::TableFragment< Config > const &, ModuleDescription const &)
 
virtual ~DecrepitRelicInputSourceImplementation () noexcept=0
 
 DecrepitRelicInputSourceImplementation (DecrepitRelicInputSourceImplementation &&)=delete
 
DecrepitRelicInputSourceImplementationoperator= (DecrepitRelicInputSourceImplementation const &)=delete
 
DecrepitRelicInputSourceImplementationoperator= (DecrepitRelicInputSourceImplementation &&)=delete
 
virtual void finish ()
 
virtual input::ItemType nextItemType () override
 
virtual void closeFile () override
 
std::unique_ptr< FileBlockreadFile () override
 Read next file. More...
 
virtual std::unique_ptr< RunPrincipalreadRun () override
 
virtual std::unique_ptr< SubRunPrincipalreadSubRun (cet::exempt_ptr< RunPrincipal const >) override
 
virtual std::unique_ptr< EventPrincipalreadEvent (cet::exempt_ptr< SubRunPrincipal const >) override
 
virtual void doBeginJob () override
 
virtual void doEndJob () override
 
virtual void skipEvents (int offset) override
 
virtual void rewind () override
 
ProcessingMode processingMode () const
 
int maxEvents () const
 
int remainingEvents () const
 
int maxSubRuns () const
 
int remainingSubRuns () const
 
void repeat_ ()
 
void issueReports (EventID const &eventID)
 
- Public Member Functions inherited from art::InputSource
virtual ~InputSource () noexcept
 
 InputSource (ModuleDescription const &)
 
 InputSource (InputSource const &)=delete
 
 InputSource (InputSource &&)=delete
 
InputSourceoperator= (InputSource const &)=delete
 
InputSourceoperator= (InputSource &&)=delete
 
virtual std::unique_ptr< RangeSetHandlerrunRangeSetHandler ()=0
 
virtual std::unique_ptr< RangeSetHandlersubRunRangeSetHandler ()=0
 
ModuleDescription const & moduleDescription () const
 
ProcessConfiguration const & processConfiguration () const
 

Protected Member Functions

input::ItemType state () const
 
void setState (input::ItemType)
 
void reset ()
 

Private Member Functions

virtual input::ItemType getNextItemType ()=0
 
virtual std::unique_ptr< RunPrincipalreadRun_ ()=0
 
virtual std::unique_ptr< SubRunPrincipalreadSubRun_ (cet::exempt_ptr< RunPrincipal const >)=0
 
virtual std::unique_ptr< EventPrincipalreadEvent_ ()=0
 
virtual std::unique_ptr< FileBlockreadFile_ ()
 
virtual void closeFile_ ()
 
virtual void beginJob ()
 
virtual void endJob ()
 
virtual void skip (int)
 
virtual void rewind_ ()
 

Private Attributes

ProcessingMode processingMode_ {RunsSubRunsAndEvents}
 
int maxEvents_
 
int maxSubRuns_
 
int const reportFrequency_
 
int remainingEvents_
 
int remainingSubRuns_
 
int numberOfEventsRead_ {}
 
input::ItemType state_ {input::IsInvalid}
 

Additional Inherited Members

- Public Types inherited from art::InputSource
enum  ProcessingMode { Runs, RunsAndSubRuns, RunsSubRunsAndEvents }
 

Detailed Description

Definition at line 58 of file DecrepitRelicInputSourceImplementation.h.

Constructor & Destructor Documentation

art::DecrepitRelicInputSourceImplementation::DecrepitRelicInputSourceImplementation ( fhicl::TableFragment< Config > const &  config,
ModuleDescription const &  desc 
)

Definition at line 40 of file DecrepitRelicInputSourceImplementation.cc.

44  : InputSource{desc}
50  {
51  if (reportFrequency_ < 0) {
53  << "reportFrequency has a negative value, which is not meaningful.";
54  }
55  std::string const runMode{"Runs"};
56  std::string const runSubRunMode{"RunsAndSubRuns"};
58  if (processingMode == runMode) {
60  } else if (processingMode == "RunsAndSubRuns") {
62  } else if (processingMode != Config::defaultMode()) {
64  << "DecrepitRelicInputSourceImplementation::"
65  "DecrepitRelicInputSourceImplementation()\n"
66  << "The 'processingMode' parameter for sources has an illegal value '"
67  << processingMode << "'\n"
68  << "Legal values are '" << Config::defaultMode() << "', '"
69  << runSubRunMode << "', or '" << runMode << "'.\n";
70  }
71  }
InputSource(ModuleDescription const &)
Definition: InputSource.cc:8
std::string string
Definition: nybbler.cc:12
static Config * config
Definition: config.cpp:1054
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
art::DecrepitRelicInputSourceImplementation::~DecrepitRelicInputSourceImplementation ( )
pure virtualdefaultnoexcept
art::DecrepitRelicInputSourceImplementation::DecrepitRelicInputSourceImplementation ( DecrepitRelicInputSourceImplementation &&  )
delete

Member Function Documentation

void art::DecrepitRelicInputSourceImplementation::beginJob ( )
privatevirtual

Reimplemented in art::EmptyEvent.

Definition at line 217 of file DecrepitRelicInputSourceImplementation.cc.

218  {}
void art::DecrepitRelicInputSourceImplementation::closeFile ( )
overridevirtual

Implements art::InputSource.

Definition at line 153 of file DecrepitRelicInputSourceImplementation.cc.

void art::DecrepitRelicInputSourceImplementation::closeFile_ ( )
privatevirtual

Definition at line 159 of file DecrepitRelicInputSourceImplementation.cc.

160  {}
void art::DecrepitRelicInputSourceImplementation::doBeginJob ( )
overridevirtual

Reimplemented from art::InputSource.

Definition at line 211 of file DecrepitRelicInputSourceImplementation.cc.

void art::DecrepitRelicInputSourceImplementation::doEndJob ( )
overridevirtual

Reimplemented from art::InputSource.

Definition at line 221 of file DecrepitRelicInputSourceImplementation.cc.

void art::DecrepitRelicInputSourceImplementation::endJob ( )
privatevirtual

Reimplemented in art::EmptyEvent.

Definition at line 227 of file DecrepitRelicInputSourceImplementation.cc.

228  {}
virtual void art::DecrepitRelicInputSourceImplementation::finish ( )
inlinevirtual

Definition at line 100 of file DecrepitRelicInputSourceImplementation.h.

101  {}
virtual input::ItemType art::DecrepitRelicInputSourceImplementation::getNextItemType ( )
privatepure virtual

Implemented in art::EmptyEvent.

void art::DecrepitRelicInputSourceImplementation::issueReports ( EventID const &  eventID)

Definition at line 312 of file DecrepitRelicInputSourceImplementation.cc.

313  {
315  }
void issue_reports(unsigned count, EventID const &id)
int art::DecrepitRelicInputSourceImplementation::maxEvents ( ) const
int art::DecrepitRelicInputSourceImplementation::maxSubRuns ( ) const
input::ItemType art::DecrepitRelicInputSourceImplementation::nextItemType ( )
overridevirtual

Implements art::InputSource.

Definition at line 74 of file DecrepitRelicInputSourceImplementation.cc.

75  {
76  auto const oldState = state_;
77  if (remainingEvents_ == 0) {
78  // If the maximum event limit has been reached, stop.
80  return state_;
81  }
82  if (remainingSubRuns_ == 0) {
83  // If the maximum subRun limit has been reached, stop
84  // when reaching a new file, run, or subRun.
85  if (oldState == input::IsInvalid || oldState == input::IsFile ||
88  return state_;
89  }
90  }
91  auto newState = getNextItemType();
92  while (true) {
93  if ((newState == input::IsEvent) &&
95  newState = getNextItemType();
96  continue;
97  }
98  if ((newState == input::IsSubRun) && (processingMode_ == Runs)) {
99  newState = getNextItemType();
100  continue;
101  }
102  break;
103  }
104  if (newState == input::IsStop) {
106  // FIXME: upon the advent of a catalog system which can do
107  // something intelligent with the difference between whole-file
108  // success, partial-file success, partial-file failure and
109  // whole-file failure (such as file-open failure), we will need to
110  // communicate that difference here. The file disposition options
111  // as they are now (and the mapping to any concrete implementation
112  // we are are aware of currently) are not sufficient to the task,
113  // so we deliberately do not distinguish here between partial-file
114  // and whole-file success in particular.
115  finish();
116  return state_;
117  } else if (newState == input::IsFile || oldState == input::IsInvalid) {
119  return state_;
120  } else if (newState == input::IsRun || oldState == input::IsFile) {
122  return state_;
123  } else if (newState == input::IsSubRun || oldState == input::IsRun) {
124  assert(processingMode_ != Runs);
126  return state_;
127  }
130  return state_;
131  }
virtual input::ItemType getNextItemType()=0
DecrepitRelicInputSourceImplementation& art::DecrepitRelicInputSourceImplementation::operator= ( DecrepitRelicInputSourceImplementation const &  )
delete
DecrepitRelicInputSourceImplementation& art::DecrepitRelicInputSourceImplementation::operator= ( DecrepitRelicInputSourceImplementation &&  )
delete
InputSource::ProcessingMode art::DecrepitRelicInputSourceImplementation::processingMode ( ) const
unique_ptr< EventPrincipal > art::DecrepitRelicInputSourceImplementation::readEvent ( cet::exempt_ptr< SubRunPrincipal const >  srp)
overridevirtual

Implements art::InputSource.

Definition at line 189 of file DecrepitRelicInputSourceImplementation.cc.

191  {
192  assert(state_ == input::IsEvent);
193  assert(remainingEvents_ != 0);
194  auto ep = readEvent_();
195  assert(srp->run() == ep->run());
196  assert(srp->subRun() == ep->subRun());
197  ep->setSubRunPrincipal(srp);
198  if (ep.get() != nullptr) {
199  if (remainingEvents_ > 0) {
201  }
204  issueReports(ep->eventID());
205  }
206  }
207  return ep;
208  }
virtual std::unique_ptr< EventPrincipal > readEvent_()=0
virtual std::unique_ptr<EventPrincipal> art::DecrepitRelicInputSourceImplementation::readEvent_ ( )
privatepure virtual

Implemented in art::EmptyEvent.

std::unique_ptr< FileBlock > art::DecrepitRelicInputSourceImplementation::readFile ( )
overridevirtual
unique_ptr< FileBlock > art::DecrepitRelicInputSourceImplementation::readFile_ ( )
privatevirtual

Definition at line 147 of file DecrepitRelicInputSourceImplementation.cc.

148  {
149  return make_unique<FileBlock>();
150  }
unique_ptr< RunPrincipal > art::DecrepitRelicInputSourceImplementation::readRun ( )
overridevirtual

Implements art::InputSource.

Definition at line 163 of file DecrepitRelicInputSourceImplementation.cc.

164  {
165  // Note: For the moment, we do not support saving and restoring the state of
166  // the random number generator if random numbers are generated during
167  // processing of runs (e.g. beginRun(), endRun())
168  assert(state_ == input::IsRun);
169  assert((remainingEvents_ != 0) && (remainingSubRuns_ != 0));
170  return readRun_();
171  }
virtual std::unique_ptr< RunPrincipal > readRun_()=0
virtual std::unique_ptr<RunPrincipal> art::DecrepitRelicInputSourceImplementation::readRun_ ( )
privatepure virtual

Implemented in art::EmptyEvent.

unique_ptr< SubRunPrincipal > art::DecrepitRelicInputSourceImplementation::readSubRun ( cet::exempt_ptr< RunPrincipal const >  rp)
overridevirtual

Implements art::InputSource.

Definition at line 174 of file DecrepitRelicInputSourceImplementation.cc.

176  {
177  // Note: For the moment, we do not support saving and restoring the state of
178  // the random number generator if random numbers are generated during
179  // processing of subRuns (e.g. beginSubRun(), endSubRun())
180  assert(state_ == input::IsSubRun);
181  assert((remainingEvents_ != 0) && (remainingSubRuns_ != 0));
183  auto srp = readSubRun_(rp);
184  srp->setRunPrincipal(rp);
185  return srp;
186  }
virtual std::unique_ptr< SubRunPrincipal > readSubRun_(cet::exempt_ptr< RunPrincipal const >)=0
virtual std::unique_ptr<SubRunPrincipal> art::DecrepitRelicInputSourceImplementation::readSubRun_ ( cet::exempt_ptr< RunPrincipal const >  )
privatepure virtual

Implemented in art::EmptyEvent.

int art::DecrepitRelicInputSourceImplementation::remainingEvents ( ) const
int art::DecrepitRelicInputSourceImplementation::remainingSubRuns ( ) const
void art::DecrepitRelicInputSourceImplementation::repeat_ ( )
void art::DecrepitRelicInputSourceImplementation::reset ( )
protected
void art::DecrepitRelicInputSourceImplementation::rewind ( )
overridevirtual
void art::DecrepitRelicInputSourceImplementation::rewind_ ( )
privatevirtual

Reimplemented in art::EmptyEvent.

Definition at line 256 of file DecrepitRelicInputSourceImplementation.cc.

257  {
259  << "DecrepitRelicInputSourceImplementation::rewind()\n"
260  << "Rewind is not implemented for this type of Input Source\n"
261  << "Contact a Framework Developer\n";
262  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
void art::DecrepitRelicInputSourceImplementation::setState ( input::ItemType  state)
protected
void art::DecrepitRelicInputSourceImplementation::skip ( int  )
privatevirtual

Reimplemented in art::EmptyEvent.

Definition at line 237 of file DecrepitRelicInputSourceImplementation.cc.

238  {
240  << "DecrepitRelicInputSourceImplementation::skip()\n"
241  << "Random access is not implemented for this type of Input Source\n"
242  << "Contact a Framework Developer\n";
243  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
void art::DecrepitRelicInputSourceImplementation::skipEvents ( int  offset)
overridevirtual

Reimplemented from art::InputSource.

Definition at line 231 of file DecrepitRelicInputSourceImplementation.cc.

232  {
233  skip(offset);
234  }
input::ItemType art::DecrepitRelicInputSourceImplementation::state ( ) const
protected

Member Data Documentation

int art::DecrepitRelicInputSourceImplementation::maxEvents_
private

Definition at line 212 of file DecrepitRelicInputSourceImplementation.h.

int art::DecrepitRelicInputSourceImplementation::maxSubRuns_
private

Definition at line 213 of file DecrepitRelicInputSourceImplementation.h.

int art::DecrepitRelicInputSourceImplementation::numberOfEventsRead_ {}
private

Definition at line 217 of file DecrepitRelicInputSourceImplementation.h.

ProcessingMode art::DecrepitRelicInputSourceImplementation::processingMode_ {RunsSubRunsAndEvents}
private

Definition at line 211 of file DecrepitRelicInputSourceImplementation.h.

int art::DecrepitRelicInputSourceImplementation::remainingEvents_
private

Definition at line 215 of file DecrepitRelicInputSourceImplementation.h.

int art::DecrepitRelicInputSourceImplementation::remainingSubRuns_
private

Definition at line 216 of file DecrepitRelicInputSourceImplementation.h.

int const art::DecrepitRelicInputSourceImplementation::reportFrequency_
private

Definition at line 214 of file DecrepitRelicInputSourceImplementation.h.

input::ItemType art::DecrepitRelicInputSourceImplementation::state_ {input::IsInvalid}
private

Definition at line 218 of file DecrepitRelicInputSourceImplementation.h.


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