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

#include "WorkerInPath.h"

Public Types

enum  FilterAction { Normal = 0, Ignore, Veto }
 

Public Member Functions

 WorkerInPath (cet::exempt_ptr< Worker >)
 
 WorkerInPath (cet::exempt_ptr< Worker > worker, FilterAction theAction)
 
template<typename T >
bool runWorker (typename T::MyPrincipal &, CurrentProcessingContext const *cpc)
 
void clearCounters ()
 
std::size_t timesVisited () const
 
std::size_t timesPassed () const
 
std::size_t timesFailed () const
 
std::size_t timesExcept () const
 
FilterAction filterAction () const
 
cet::exempt_ptr< WorkergetWorker () const
 
std::string const & label () const
 
bool modifiesEvent () const
 

Private Types

using Counts_t = ExecutionCounts< stats::Visited, stats::Passed, stats::Failed, stats::ExceptionThrown >
 

Private Attributes

Counts_t counts_ {}
 
FilterAction filterAction_ {Normal}
 
cet::exempt_ptr< Workerworker_
 

Detailed Description

Definition at line 23 of file WorkerInPath.h.

Member Typedef Documentation

Member Enumeration Documentation

Enumerator
Normal 
Ignore 
Veto 

Definition at line 25 of file WorkerInPath.h.

Constructor & Destructor Documentation

WorkerInPath::WorkerInPath ( cet::exempt_ptr< Worker w)
explicit

Definition at line 17 of file WorkerInPath.cc.

17 : worker_{w} {}
Float_t w
Definition: plot.C:23
cet::exempt_ptr< Worker > worker_
Definition: WorkerInPath.h:91
WorkerInPath::WorkerInPath ( cet::exempt_ptr< Worker worker,
FilterAction  theAction 
)

Definition at line 12 of file WorkerInPath.cc.

References w, and worker_.

14  : filterAction_{theFilterAction}, worker_{w}
15 {}
FilterAction filterAction_
Definition: WorkerInPath.h:90
Float_t w
Definition: plot.C:23
cet::exempt_ptr< Worker > worker_
Definition: WorkerInPath.h:91

Member Function Documentation

void art::WorkerInPath::clearCounters ( )
inline

Definition at line 35 of file WorkerInPath.h.

References counts_.

36  {
37  counts_ = Counts_t{};
38  }
ExecutionCounts< stats::Visited, stats::Passed, stats::Failed, stats::ExceptionThrown > Counts_t
Definition: WorkerInPath.h:87
FilterAction art::WorkerInPath::filterAction ( ) const
inline

Definition at line 62 of file WorkerInPath.h.

References filterAction_.

63  {
64  return filterAction_;
65  }
FilterAction filterAction_
Definition: WorkerInPath.h:90
cet::exempt_ptr<Worker> art::WorkerInPath::getWorker ( ) const
inline

Definition at line 67 of file WorkerInPath.h.

References worker_.

68  {
69  return worker_;
70  }
cet::exempt_ptr< Worker > worker_
Definition: WorkerInPath.h:91
std::string const& art::WorkerInPath::label ( ) const
inline

Definition at line 73 of file WorkerInPath.h.

References worker_.

74  {
75  return worker_->label();
76  }
cet::exempt_ptr< Worker > worker_
Definition: WorkerInPath.h:91
bool art::WorkerInPath::modifiesEvent ( ) const
inline

Definition at line 78 of file WorkerInPath.h.

References worker_.

79  {
80  return worker_->modifiesEvent();
81  }
cet::exempt_ptr< Worker > worker_
Definition: WorkerInPath.h:91
template<typename T >
bool art::WorkerInPath::runWorker ( typename T::MyPrincipal &  ep,
CurrentProcessingContext const *  cpc 
)

Definition at line 96 of file WorkerInPath.h.

References counts_, art::Event, filterAction_, Ignore, Veto, and worker_.

98  {
99  MaybeIncrementCounts<T::level, decltype(counts_)> counts{counts_};
100  counts.template increment<stats::Visited>();
101 
102  bool rc{true};
103  try {
104  // may want to change the return value from the worker to be the
105  // Worker::FilterAction so conditions in the path will be easier
106  // to identify
107  rc = worker_->doWork<T>(ep, cpc);
108  }
109  catch (...) {
110  counts.template increment<stats::ExceptionThrown>();
111  throw;
112  }
113 
114  // Ignore return code for non-event (e.g. run, subRun) calls
115  if (T::level == Level::Event && filterAction_ == Veto)
116  rc = !rc;
117  else if (T::level != Level::Event || filterAction_ == Ignore)
118  rc = true;
119 
120  counts.update(rc);
121  return rc;
122  } // runWorker<>()
FilterAction filterAction_
Definition: WorkerInPath.h:90
cet::exempt_ptr< Worker > worker_
Definition: WorkerInPath.h:91
std::size_t art::WorkerInPath::timesExcept ( ) const
inline

Definition at line 56 of file WorkerInPath.h.

References counts_, and art::ExecutionCounts< ARGS >::times().

57  {
58  return counts_.times<stats::ExceptionThrown>();
59  }
std::size_t times() const
std::size_t art::WorkerInPath::timesFailed ( ) const
inline

Definition at line 51 of file WorkerInPath.h.

References counts_, and art::ExecutionCounts< ARGS >::times().

52  {
53  return counts_.times<stats::Failed>();
54  }
std::size_t times() const
std::size_t art::WorkerInPath::timesPassed ( ) const
inline

Definition at line 46 of file WorkerInPath.h.

References counts_, and art::ExecutionCounts< ARGS >::times().

47  {
48  return counts_.times<stats::Passed>();
49  }
std::size_t times() const
std::size_t art::WorkerInPath::timesVisited ( ) const
inline

Definition at line 41 of file WorkerInPath.h.

References counts_, and art::ExecutionCounts< ARGS >::times().

42  {
43  return counts_.times<stats::Visited>();
44  }
std::size_t times() const

Member Data Documentation

Counts_t art::WorkerInPath::counts_ {}
private
FilterAction art::WorkerInPath::filterAction_ {Normal}
private

Definition at line 90 of file WorkerInPath.h.

Referenced by filterAction(), and runWorker().

cet::exempt_ptr<Worker> art::WorkerInPath::worker_
private

Definition at line 91 of file WorkerInPath.h.

Referenced by getWorker(), label(), modifiesEvent(), runWorker(), and WorkerInPath().


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