Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:12:05

0001 #ifndef FWCore_Framework_ProcessingController_h
0002 #define FWCore_Framework_ProcessingController_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     Framework
0006 // Class  :     ProcessingController
0007 //
0008 /**\class ProcessingController ProcessingController.h FWCore/Framework/interface/ProcessingController.h
0009 
0010  Description: Interface used by an EDLooper to specify what event we should process next
0011 
0012  Usage:
0013     <usage>
0014 
0015 */
0016 //
0017 // Original Author:  Chris Jones
0018 //         Created:  Fri Aug  6 16:06:01 CDT 2010
0019 //
0020 
0021 // system include files
0022 
0023 // user include files
0024 #include "DataFormats/Provenance/interface/EventID.h"
0025 
0026 // forward declarations
0027 namespace edm {
0028 
0029   class ProcessingController {
0030   public:
0031     enum ForwardState {
0032       kEventsAheadInFile,
0033       kNextFileExists,  // but no events ahead in this file
0034       kAtLastEvent,
0035       kUnknownForward  // returned by a source which is not random accessible
0036     };
0037 
0038     enum ReverseState {
0039       kEventsBackwardsInFile,
0040       kPreviousFileExists,  // but no events backwards in this file
0041       kAtFirstEvent,
0042       kUnknownReverse  // returned by a source which is not random accessible
0043     };
0044 
0045     ProcessingController(ForwardState forwardState, ReverseState reverseState, bool iCanRandomAccess);
0046     ProcessingController(const ProcessingController&) = delete;                   // stop default
0047     const ProcessingController& operator=(const ProcessingController&) = delete;  // stop default
0048 
0049     // ---------- const member functions ---------------------
0050 
0051     ///Returns the present state of processing
0052     ForwardState forwardState() const;
0053     ReverseState reverseState() const;
0054 
0055     ///Returns 'true' if the job's source can randomly access
0056     bool canRandomAccess() const;
0057 
0058     enum Transition { kToNextEvent, kToPreviousEvent, kToSpecifiedEvent };
0059 
0060     Transition requestedTransition() const;
0061 
0062     ///If 'setTransitionToEvent was called this returns the value passed,
0063     /// else it returns an invalid EventID
0064     edm::EventID specifiedEventTransition() const;
0065 
0066     bool lastOperationSucceeded() const;
0067 
0068     // ---------- static member functions --------------------
0069 
0070     // ---------- member functions ---------------------------
0071 
0072     /** Tells the framework that we should go onto the next event in the sequence.
0073        If there is no next event the job will drop out of the event loop.
0074        */
0075     void setTransitionToNextEvent();
0076 
0077     /** Tells the framework we should backup and run the previous event seen in the sequence.
0078        If you are already at the first event the job will drop out of the event loop
0079        */
0080     void setTransitionToPreviousEvent();
0081 
0082     /** Tells the framework that the next event to processes should be iID.
0083        If event iID can not be found in the source, the job will drop out of the event loop.
0084        */
0085     void setTransitionToEvent(edm::EventID const& iID);
0086 
0087     void setLastOperationSucceeded(bool value);
0088 
0089   private:
0090     // ---------- member data --------------------------------
0091     ForwardState forwardState_;
0092     ReverseState reverseState_;
0093     Transition transition_;
0094     EventID specifiedEvent_;
0095     bool canRandomAccess_;
0096     bool lastOperationSucceeded_;
0097   };
0098 }  // namespace edm
0099 #endif