psana::EventLoop Class Reference
[psana package]

Implementation of the event loop for psana. More...

#include <EventLoop.h>

List of all members.

Public Types

typedef boost::shared_ptr<
PSEvt::Event
EventPtr
typedef std::pair< EventType,
EventPtr
value_type
 BeginJob
 Returned at the begin of job.
 BeginRun
 Returned at the begin of run.
 BeginCalibCycle
 Returned at the begin of calib cycle.
 Event
 Returned for regular event.
 EndCalibCycle
 Returned at the end of calib cycle.
 EndRun
 Returned at the end of run.
 EndJob
 Returned at the end of job.
 None
 Returned if there are no more events.
enum  EventType {
  BeginJob, BeginRun, BeginCalibCycle, Event,
  EndCalibCycle, EndRun, EndJob, None
}
 Enumeration for the event types returned by iterator. More...

Public Member Functions

 EventLoop (const boost::shared_ptr< InputModule > &inputModule, const std::vector< boost::shared_ptr< Module > > &modules, const boost::shared_ptr< PSEnv::Env > &env)
 Constructor takes instance of input module, and a list of user modules.
 ~EventLoop ()
PSEnv::Envenv () const
 Get environment object.
value_type next ()
void putback (const value_type &value)
 "Return" an event back to the input stream.
void addmodule (boost::shared_ptr< Module > module)
bool liveAvail (int numEvents)
Indexindex ()


Detailed Description

Implementation of the event loop for psana.

The purpose of this class is to provide iteration over "events" in psana framework with well-defined properties. Event in this context means not only regular events but also transitions like BeginRun, EndRun, etc. Instance of this class acts like iterator which returns two items for each iteration - event type and event contents (PSEvt::Event object). It guarantees correct nesting of transitions and events, so that regular events happen only inside BeginCalibCycle/EndCalibCycle, which in turn happen only inside BeginRun/EndRun. On every iteration this instance calls corresponding method of the user modules before returning event to caller so that user modules can add more data to event.

This software was developed for the LCLS project. If you use all or part of it, please give an appropriate acknowledgment.

Version:
Id
EventLoop.h 10732 2015-09-23 22:07:46Z davidsch@SLAC.STANFORD.EDU
Author:
Andy Salnikov

Definition at line 76 of file EventLoop.h.


Member Typedef Documentation

typedef boost::shared_ptr<PSEvt::Event> psana::EventLoop::EventPtr

Definition at line 91 of file EventLoop.h.

typedef std::pair<EventType, EventPtr> psana::EventLoop::value_type

Definition at line 92 of file EventLoop.h.


Member Enumeration Documentation

enum psana::EventLoop::EventType

Enumeration for the event types returned by iterator.

Enumerator:
BeginJob  Returned at the begin of job.
BeginRun  Returned at the begin of run.
BeginCalibCycle  Returned at the begin of calib cycle.
Event  Returned for regular event.
EndCalibCycle  Returned at the end of calib cycle.
EndRun  Returned at the end of run.
EndJob  Returned at the end of job.
None  Returned if there are no more events.

Definition at line 80 of file EventLoop.h.


Constructor & Destructor Documentation

psana::EventLoop::EventLoop ( const boost::shared_ptr< InputModule > &  inputModule,
const std::vector< boost::shared_ptr< Module > > &  modules,
const boost::shared_ptr< PSEnv::Env > &  env 
)

Constructor takes instance of input module, and a list of user modules.

Definition at line 58 of file EventLoop.cpp.

References psana::Module::beginCalibCycle(), BeginCalibCycle, psana::Module::beginJob(), BeginJob, psana::Module::beginRun(), BeginRun, psana::Module::endCalibCycle(), EndCalibCycle, psana::Module::endJob(), EndJob, psana::Module::endRun(), EndRun, psana::Module::event(), Event, and None.

psana::EventLoop::~EventLoop (  ) 

Definition at line 79 of file EventLoop.cpp.


Member Function Documentation

void psana::EventLoop::addmodule ( boost::shared_ptr< Module module  )  [inline]

Definition at line 127 of file EventLoop.h.

PSEnv::Env & psana::EventLoop::env (  )  const

Get environment object.

Definition at line 85 of file EventLoop.cpp.

Index & psana::EventLoop::index (  ) 

Definition at line 216 of file EventLoop.cpp.

bool psana::EventLoop::liveAvail ( int  numEvents  ) 

Definition at line 221 of file EventLoop.cpp.

EventLoop::value_type psana::EventLoop::next (  ) 

Method that runs one iteration and returns event type, and event object.

Definition at line 95 of file EventLoop.cpp.

References psana::Module::Abort, Event, eventType(), None, and psana::Module::Stop.

void psana::EventLoop::putback ( const value_type value  )  [inline]

"Return" an event back to the input stream.

If you want to look ahead for the next event, to check its type, for example, then you can call next() followed by putback().

Definition at line 120 of file EventLoop.h.


The documentation for this class was generated from the following files:
Generated on 19 Dec 2016 for PSANAclasses by  doxygen 1.4.7