1 #ifndef FWCore_Framework_Worker_h
2 #define FWCore_Framework_Worker_h
35 #include "boost/shared_ptr.hpp"
45 class ProductHolderIndexHelper;
136 unsigned int iNumberOfChildren) = 0;
156 template <
typename T>
157 class ModuleSignalSentry {
160 if(a_) T::preModuleSignal(a_, md_);
162 ~ModuleSignalSentry() {
163 if(a_) T::postModuleSignal(a_, md_);
170 template <
typename T>
171 void exceptionContext(
typename T::MyPrincipal
const&
principal,
173 CurrentProcessingContext
const* cpc) {
174 std::ostringstream ost;
176 ost <<
"Calling event method";
178 else if (T::begin_ && T::branchType_ ==
InRun) {
179 ost <<
"Calling beginRun";
181 else if (T::begin_ && T::branchType_ ==
InLumi) {
182 ost <<
"Calling beginLuminosityBlock";
184 else if (!T::begin_ && T::branchType_ ==
InLumi) {
185 ost <<
"Calling endLuminosityBlock";
187 else if (!T::begin_ && T::branchType_ ==
InRun) {
188 ost <<
"Calling endRun";
192 ost <<
"Calling unknown function";
194 if (cpc && cpc->moduleDescription()) {
195 ost <<
" for module " << cpc->moduleDescription()->
moduleName() <<
"/'" << cpc->moduleDescription()->moduleLabel() <<
"'";
199 ost <<
"Running path '";
200 if (cpc && cpc->pathName()) {
201 ost << *cpc->pathName() <<
"'";
208 ost <<
"Processing ";
209 ost << principal.id();
214 template <
typename T>
231 case Pass:
return true;
232 case Fail:
return false;
243 ModuleSignalSentry<T> cpp(
actReg_.get(),
md_);
287 exceptionContext<T>(ep, ex, cpc);
void pathFinished(EventPrincipal &)
ModuleDescription const & description() const
void setEarlyDeleteHelper(EarlyDeleteHelper *iHelper)
bool isEndPath() const
Return true if the path is an end path, and false otherwise.
virtual void implPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)=0
virtual void implRespondToOpenOutputFiles(FileBlock const &fb)=0
boost::shared_ptr< ActivityRegistry > actReg_
void setActivityRegistry(boost::shared_ptr< ActivityRegistry > areg)
virtual void implRespondToCloseInputFile(FileBlock const &fb)=0
void respondToOpenOutputFiles(FileBlock const &fb)
std::string const & moduleName() const
std::string const & category() const
virtual void implPreForkReleaseResources()=0
virtual std::string workerType() const =0
virtual bool implDoEnd(EventPrincipal &, EventSetup const &c, CurrentProcessingContext const *cpc)=0
std::pair< double, double > timeCpuReal() const
EarlyDeleteHelper * earlyDeleteHelper_
bool isUnscheduled() const
Returns true if the module is being called via unscheduled execution.
virtual bool implDoBegin(EventPrincipal &, EventSetup const &c, CurrentProcessingContext const *cpc)=0
virtual void updateLookup(BranchType iBranchType, ProductHolderIndexHelper const &)=0
Worker & operator=(Worker const &)=delete
boost::shared_ptr< CPUTimer > StopwatchPointer
virtual void implRespondToCloseOutputFiles(FileBlock const &fb)=0
void stdToEDM(std::exception const &e)
ModuleDescription const * descPtr() const
void printCmsExceptionWarning(char const *behavior, cms::Exception const &e, edm::JobReport *jobRep=0, int rc=-1)
virtual void implEndJob()=0
void postForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)
virtual Types moduleType() const =0
void postDoEvent(EventPrincipal &)
void respondToCloseOutputFiles(FileBlock const &fb)
void charPtrToEDM(char const *c)
void stringToEDM(std::string &s)
boost::shared_ptr< cms::Exception > cached_exception_
virtual void implBeginJob()=0
void respondToOpenInputFile(FileBlock const &fb)
void addContext(std::string const &context)
ActionTable const * actions_
void respondToCloseInputFile(FileBlock const &fb)
Worker(ModuleDescription const &iMD, WorkerParams const &iWP)
void preForkReleaseResources()
RunStopwatch::StopwatchPointer stopwatch_
actions::ActionCodes find(const std::string &category) const
bool doWork(typename T::MyPrincipal &, EventSetup const &c, CurrentProcessingContext const *cpc, CPUTimer *const timer)
virtual void implRespondToOpenInputFile(FileBlock const &fb)=0