CMS 3D CMS Logo

edm::WorkerInPath Class Reference

#include <FWCore/Framework/src/WorkerInPath.h>

List of all members.

Public Types

enum  FilterAction { Normal = 0, Ignore, Veto }

Public Member Functions

void clearCounters ()
FilterAction filterAction () const
WorkergetWorker () const
template<typename T>
bool runWorker (typename T::MyPrincipal &, EventSetup const &, CurrentProcessingContext const *cpc)
std::pair< double, double > timeCpuReal () const
int timesExcept () const
int timesFailed () const
int timesPassed () const
int timesVisited () const
 WorkerInPath (Worker *, FilterAction theAction)
 WorkerInPath (Worker *)

Private Attributes

FilterAction filterAction_
RunStopwatch::StopwatchPointer stopwatch_
int timesExcept_
int timesFailed_
int timesPassed_
int timesVisited_
Workerworker_


Detailed Description

Definition at line 21 of file WorkerInPath.h.


Member Enumeration Documentation

enum edm::WorkerInPath::FilterAction

Enumerator:
Normal 
Ignore 
Veto 

Definition at line 23 of file WorkerInPath.h.

00023 { Normal=0, Ignore, Veto };


Constructor & Destructor Documentation

edm::WorkerInPath::WorkerInPath ( Worker w  )  [explicit]

Definition at line 17 of file WorkerInPath.cc.

00017                                      :
00018     stopwatch_(new RunStopwatch::StopwatchPointer::element_type),
00019     timesVisited_(),
00020     timesPassed_(),
00021     timesFailed_(),
00022     timesExcept_(),
00023     filterAction_(Normal),
00024     worker_(w)
00025   {
00026   }

edm::WorkerInPath::WorkerInPath ( Worker w,
FilterAction  theAction 
)

Definition at line 6 of file WorkerInPath.cc.

00006                                                                    :
00007     stopwatch_(new RunStopwatch::StopwatchPointer::element_type),
00008     timesVisited_(),
00009     timesPassed_(),
00010     timesFailed_(),
00011     timesExcept_(),
00012     filterAction_(theFilterAction),
00013     worker_(w)
00014   {
00015   }


Member Function Documentation

void edm::WorkerInPath::clearCounters (  )  [inline]

Definition at line 36 of file WorkerInPath.h.

References timesExcept_, timesFailed_, timesPassed_, and timesVisited_.

Referenced by edm::Path::clearCounters().

00036                          {
00037       timesVisited_ = timesPassed_ = timesFailed_ = timesExcept_ = 0;
00038     }

FilterAction edm::WorkerInPath::filterAction (  )  const [inline]

Definition at line 45 of file WorkerInPath.h.

References filterAction_.

00045 { return filterAction_; }

Worker* edm::WorkerInPath::getWorker (  )  const [inline]

Definition at line 46 of file WorkerInPath.h.

References worker_.

00046 { return worker_; }

template<typename T>
bool edm::WorkerInPath::runWorker ( typename T::MyPrincipal &  ep,
EventSetup const &  es,
CurrentProcessingContext const *  cpc 
) [inline]

Definition at line 61 of file WorkerInPath.h.

References edm::Worker::doWork(), filterAction_, Ignore, stopwatch_, timesExcept_, timesFailed_, timesPassed_, timesVisited_, Veto, and worker_.

00062                                                                     {
00063 
00064     // A RunStopwatch, but only if we are processing an event.
00065     std::auto_ptr<RunStopwatch> stopwatch(T::isEvent_ ? new RunStopwatch(stopwatch_) : 0);
00066 
00067     if (T::isEvent_) {
00068       ++timesVisited_;
00069     }
00070     bool rc = true;
00071 
00072     try {
00073         // may want to change the return value from the worker to be 
00074         // the Worker::FilterAction so conditions in the path will be easier to 
00075         // identify
00076         rc = worker_->doWork<T>(ep, es, cpc);
00077 
00078         // Ignore return code for non-event (e.g. run, lumi) calls
00079         if (!T::isEvent_) rc = true;
00080         else if (filterAction_ == Veto) rc = !rc;
00081         else if (filterAction_ == Ignore) rc = true;
00082 
00083         if (T::isEvent_) {
00084           if(rc) ++timesPassed_; else ++timesFailed_;
00085         }
00086     }
00087     catch(...) {
00088         if (T::isEvent_) ++timesExcept_;
00089         throw;
00090     }
00091 
00092     return rc;
00093   }

std::pair<double,double> edm::WorkerInPath::timeCpuReal (  )  const [inline]

Definition at line 32 of file WorkerInPath.h.

References stopwatch_.

00032                                                {
00033       return std::pair<double,double>(stopwatch_->cpuTime(),stopwatch_->realTime());
00034     }

int edm::WorkerInPath::timesExcept (  )  const [inline]

Definition at line 43 of file WorkerInPath.h.

References timesExcept_.

00043 { return timesExcept_; }

int edm::WorkerInPath::timesFailed (  )  const [inline]

Definition at line 42 of file WorkerInPath.h.

References timesFailed_.

00042 { return timesFailed_; }

int edm::WorkerInPath::timesPassed (  )  const [inline]

Definition at line 41 of file WorkerInPath.h.

References timesPassed_.

00041 { return timesPassed_; }

int edm::WorkerInPath::timesVisited (  )  const [inline]

Definition at line 40 of file WorkerInPath.h.

References timesVisited_.

00040 { return timesVisited_; }


Member Data Documentation

FilterAction edm::WorkerInPath::filterAction_ [private]

Definition at line 56 of file WorkerInPath.h.

Referenced by filterAction(), and runWorker().

RunStopwatch::StopwatchPointer edm::WorkerInPath::stopwatch_ [private]

Definition at line 49 of file WorkerInPath.h.

Referenced by runWorker(), and timeCpuReal().

int edm::WorkerInPath::timesExcept_ [private]

Definition at line 54 of file WorkerInPath.h.

Referenced by clearCounters(), runWorker(), and timesExcept().

int edm::WorkerInPath::timesFailed_ [private]

Definition at line 53 of file WorkerInPath.h.

Referenced by clearCounters(), runWorker(), and timesFailed().

int edm::WorkerInPath::timesPassed_ [private]

Definition at line 52 of file WorkerInPath.h.

Referenced by clearCounters(), runWorker(), and timesPassed().

int edm::WorkerInPath::timesVisited_ [private]

Definition at line 51 of file WorkerInPath.h.

Referenced by clearCounters(), runWorker(), and timesVisited().

Worker* edm::WorkerInPath::worker_ [private]

Definition at line 57 of file WorkerInPath.h.

Referenced by getWorker(), and runWorker().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:44:47 2009 for CMSSW by  doxygen 1.5.4