00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "psana/StepIter.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 StepIter::StepIter ()
00040 : m_evtLoop()
00041 {
00042 }
00043
00044
00045 StepIter::StepIter (const boost::shared_ptr<EventLoop>& evtLoop, EventLoop::EventType stopType)
00046 : m_evtLoop(evtLoop)
00047 , m_stopType(stopType)
00048 {
00049 }
00050
00051
00052
00053
00054 StepIter::~StepIter ()
00055 {
00056 }
00057
00058
00059
00060 std::pair<StepIter::value_type, boost::shared_ptr<PSEvt::Event> >
00061 StepIter::nextWithEvent()
00062 {
00063 std::pair<StepIter::value_type, boost::shared_ptr<PSEvt::Event> > result;
00064 if (m_stopType == EventLoop::Event) {
00065
00066 return result;
00067 }
00068
00069 while (true) {
00070 EventLoop::value_type nxt = m_evtLoop->next();
00071 if (nxt.first == EventLoop::None) {
00072
00073 m_stopType = EventLoop::Event;
00074 break;
00075 } else if (nxt.first == m_stopType) {
00076
00077
00078 m_evtLoop->putback(nxt);
00079 m_stopType = EventLoop::Event;
00080 break;
00081 } else if (nxt.first == EventLoop::BeginCalibCycle) {
00082
00083 result = std::pair<StepIter::value_type,
00084 boost::shared_ptr<PSEvt::Event> >(StepIter::value_type(m_evtLoop), nxt.second);
00085 break;
00086 }
00087 }
00088 return result;
00089 }
00090
00091
00092 StepIter::value_type
00093 StepIter::next()
00094 {
00095 return nextWithEvent().first;
00096 }
00097
00098 }