Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:27:23

0001 #ifndef Fireworks_FWInterface_FWFFNavigator_h
0002 #define Fireworks_FWInterface_FWFFNavigator_h
0003 
0004 #include "Fireworks/Core/interface/FWNavigatorBase.h"
0005 #include "FWCore/Framework/interface/Event.h"
0006 
0007 namespace edm {
0008   class EventBase;
0009 }
0010 
0011 class FWFFNavigator : public FWNavigatorBase {
0012 public:
0013   enum FWFFNavigatorState { kNoTransition, kNextEvent, kPreviousEvent, kFirstEvent, kLastEvent };
0014 
0015   FWFFNavigator(CmsShowMainBase &main)
0016       : FWNavigatorBase(main), m_currentEvent(nullptr), m_currentTransition(kNoTransition) {}
0017   // Discard configuration for the time being.
0018   void addTo(FWConfiguration &) const override {}
0019   void setFrom(const FWConfiguration &) override {}
0020 
0021   void nextEvent() override;
0022   void previousEvent() override;
0023   // nextSelectedEvent and nextEvent are the same thing
0024   // for full framework, since there is no filtering.
0025   bool nextSelectedEvent() override {
0026     nextEvent();
0027     return true;
0028   }
0029   bool previousSelectedEvent() override {
0030     previousEvent();
0031     return true;
0032   }
0033 
0034   // FIXME: for the time being there is no way to go to
0035   //        first / last event.
0036   void firstEvent() override;
0037   void lastEvent() override;
0038   // FIXME: does not do anything for the time being.
0039   void goToRunEvent(edm::RunNumber_t, edm::LuminosityBlockNumber_t, edm::EventNumber_t) override {}
0040   // Notice that we have no way to tell whether the current one
0041   // is the last event in a stream.
0042   bool isLastEvent() override { return false; }
0043   bool isFirstEvent() override { return m_currentEvent->id() == m_firstEventID; }
0044   // FIXME: we need to change the API of the baseclass first.
0045   const edm::EventBase *getCurrentEvent() const override { return m_currentEvent; }
0046   // The number of selected events is always the total number of event.
0047   int getNSelectedEvents() override { return getNTotalEvents(); }
0048   // FIXME: I guess there is no way to tell how many events
0049   //        we have.
0050   int getNTotalEvents() override { return 0; }
0051 
0052   // Use to set the event from the framework.
0053   void setCurrentEvent(const edm::Event *);
0054   const edm::EventID &getFirstEventID();
0055   enum FWFFNavigatorState currentTransition() { return m_currentTransition; }
0056   void resetTransition() { m_currentTransition = kNoTransition; }
0057 
0058 private:
0059   const edm::Event *m_currentEvent;
0060   edm::EventID m_firstEventID;
0061   enum FWFFNavigatorState m_currentTransition;
0062 };
0063 
0064 #endif