00001 #ifndef PSANA_EVENTITER_H 00002 #define PSANA_EVENTITER_H 00003 00004 //-------------------------------------------------------------------------- 00005 // File and Version Information: 00006 // $Id: EventIter.h 6430 2013-06-24 17:12:58Z salnikov@SLAC.STANFORD.EDU $ 00007 // 00008 // Description: 00009 // Class EventIter. 00010 // 00011 //------------------------------------------------------------------------ 00012 00013 //----------------- 00014 // C/C++ Headers -- 00015 //----------------- 00016 #include <boost/shared_ptr.hpp> 00017 00018 //---------------------- 00019 // Base Class Headers -- 00020 //---------------------- 00021 00022 //------------------------------- 00023 // Collaborating Class Headers -- 00024 //------------------------------- 00025 #include "psana/EventLoop.h" 00026 #include "PSEvt/Event.h" 00027 00028 //------------------------------------ 00029 // Collaborating Class Declarations -- 00030 //------------------------------------ 00031 00032 // --------------------- 00033 // -- Class Interface -- 00034 // --------------------- 00035 00036 namespace psana { 00037 00038 /// @addtogroup psana 00039 00040 /** 00041 * @ingroup psana 00042 * 00043 * @brief Class representing iterator over events. 00044 * 00045 * This class uses EventLoop class as a source of raw events, it then 00046 * selects events of "Event" type and returns them one by one when 00047 * next() method is called. Iteration stops when there are no more 00048 * events left in the input source or when specified "stop" event 00049 * type is reached. To iterate over all events from begin to end use 00050 * None event type, to stop at the end of the run use EndRun type, 00051 * to stop at the end of the step use EndCalibCycle event type. 00052 * 00053 * This software was developed for the LCLS project. If you use all or 00054 * part of it, please give an appropriate acknowledgment. 00055 * 00056 * @version $Id: EventIter.h 6430 2013-06-24 17:12:58Z salnikov@SLAC.STANFORD.EDU $ 00057 * 00058 * @author Andy Salnikov 00059 */ 00060 00061 class EventIter { 00062 public: 00063 00064 /// Default constructor makes invalid iterator 00065 EventIter () ; 00066 00067 /** 00068 * @brief Constructor takes event loop instance and "stop event type". 00069 * 00070 * Do not use EventLoop::Event for stop type, first it does not make 00071 * sense, second this iterator uses it for special purpose. 00072 */ 00073 EventIter (const boost::shared_ptr<EventLoop>& evtLoop, EventLoop::EventType stopType); 00074 00075 // Destructor 00076 ~EventIter(); 00077 00078 /// get next event, returns zero pointer when done 00079 boost::shared_ptr<PSEvt::Event> next(); 00080 00081 protected: 00082 00083 private: 00084 00085 // Data members 00086 boost::shared_ptr<EventLoop> m_evtLoop; 00087 EventLoop::EventType m_stopType; 00088 00089 }; 00090 00091 } // namespace psana 00092 00093 #endif // PSANA_EVENTITER_H