00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "psana/EventIter.h"
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 namespace psana {
00035
00036
00037
00038
00039 EventIter::EventIter ()
00040 : m_evtLoop()
00041 , m_stopType(EventLoop::None)
00042 {
00043 }
00044
00045 EventIter::EventIter (const boost::shared_ptr<EventLoop>& evtLoop, EventLoop::EventType stopType)
00046 : m_evtLoop(evtLoop)
00047 , m_stopType(stopType)
00048 {
00049 }
00050
00051
00052
00053
00054 EventIter::~EventIter ()
00055 {
00056 }
00057
00058
00059 boost::shared_ptr<PSEvt::Event>
00060 EventIter::next()
00061 {
00062 boost::shared_ptr<PSEvt::Event> result;
00063 if (m_stopType == EventLoop::Event) {
00064
00065 return result;
00066 }
00067
00068 while (true) {
00069 EventLoop::value_type nxt = m_evtLoop->next();
00070 if (nxt.first == EventLoop::None) {
00071
00072 m_stopType = EventLoop::Event;
00073 break;
00074 } else if (nxt.first == m_stopType) {
00075
00076
00077 m_evtLoop->putback(nxt);
00078 m_stopType = EventLoop::Event;
00079 break;
00080 } else if (nxt.first == EventLoop::Event) {
00081
00082 result = nxt.second;
00083 break;
00084 }
00085 }
00086 return result;
00087 }
00088
00089 }