CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/FWCore/Framework/interface/IEventProcessor.h

Go to the documentation of this file.
00001 #ifndef FWCore_Framework_IEventProcessor_h
00002 #define FWCore_Framework_IEventProcessor_h
00003 
00004 /*
00005 Abstract base class for Event Processors
00006 
00007 Original Authors: W. David Dagenhart, Marc Paterno
00008 */
00009 
00010 #include "DataFormats/Provenance/interface/ProcessHistoryID.h"
00011 
00012 #include <string>
00013 
00014 namespace statemachine {
00015   class Restart;
00016   class Run;
00017 }
00018 
00019 namespace edm {
00020   class IEventProcessor {
00021   public:
00022 
00023     // Status codes:
00024     //   0     successful completion
00025     //   1     exception of unknown type caught
00026     //   2     everything else
00027     //   3     signal received
00028     //   4     input complete
00029     //   5     call timed out
00030     //   6     input count complete
00031     enum Status { epSuccess=0, epException=1, epOther=2, epSignal=3,
00032                   epInputComplete=4, epTimedOut=5, epCountComplete=6 };
00033 
00034     // Eventually, we might replace StatusCode with a class. This
00035     // class should have an automatic conversion to 'int'.
00036     typedef Status StatusCode ;
00037 
00038     virtual ~IEventProcessor();
00039 
00040     virtual StatusCode runToCompletion(bool onlineStateTransitions) = 0;
00041     virtual StatusCode runEventCount(int numberOfEventsToProcess) = 0;
00042 
00043     virtual void readFile() = 0;
00044     virtual void closeInputFile() = 0;
00045     virtual void openOutputFiles() = 0;
00046     virtual void closeOutputFiles() = 0;
00047 
00048     virtual void respondToOpenInputFile() = 0;
00049     virtual void respondToCloseInputFile() = 0;
00050     virtual void respondToOpenOutputFiles() = 0;
00051     virtual void respondToCloseOutputFiles() = 0;
00052 
00053     virtual void startingNewLoop() = 0;
00054     virtual bool endOfLoop() = 0;
00055     virtual void rewindInput() = 0;
00056     virtual void prepareForNextLoop() = 0;
00057     virtual bool shouldWeCloseOutput() const = 0;
00058 
00059     virtual void doErrorStuff() = 0;
00060 
00061     virtual void beginRun(statemachine::Run const& run) = 0;
00062     virtual void endRun(statemachine::Run const& run) = 0;
00063 
00064     virtual void beginLumi(ProcessHistoryID const& phid, int run, int lumi) = 0;
00065     virtual void endLumi(ProcessHistoryID const& phid, int run, int lumi) = 0;
00066 
00067     virtual statemachine::Run readAndCacheRun() = 0;
00068     virtual int readAndCacheLumi() = 0;
00069     virtual void writeRun(statemachine::Run const& run) = 0;
00070     virtual void deleteRunFromCache(statemachine::Run const& run) = 0;
00071     virtual void writeLumi(ProcessHistoryID const& phid, int run, int lumi) = 0;
00072     virtual void deleteLumiFromCache(ProcessHistoryID const& phid,int run, int lumi) = 0;
00073 
00074     virtual void readAndProcessEvent() = 0;
00075     virtual bool shouldWeStop() const = 0;
00076 
00077     virtual void setExceptionMessageFiles(std::string& message) = 0;
00078     virtual void setExceptionMessageRuns(std::string& message) = 0;
00079     virtual void setExceptionMessageLumis(std::string& message) = 0;
00080 
00081     virtual bool alreadyHandlingException() const = 0;
00082   };
00083 }
00084 
00085 #endif