lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
XtcData::XtcIterator Class Referenceabstract

Abstract iterator over the child xtcs of a root Xtc. More...

#include <XtcIterator.hh>

Inherited by XtcData::DataIter, XtcData::NamesIter, and XtcData::XtcUpdateIter.

Public Member Functions

 XtcIterator (Xtc *root, const void *bufEnd)
 Store root and bufEnd for use by iterate().
 
 XtcIterator ()
 Default constructor; root and bufEnd are left uninitialized (use iterate(Xtc*, const void*)).
 
virtual ~XtcIterator ()
 Virtual destructor; does nothing.
 
virtual int process (Xtc *xtc, const void *bufEnd)=0
 Called by iterate() for each child xtc; return 0 to stop iterating, nonzero to continue.
 
void iterate ()
 Call iterate(root, bufEnd) with the values given to the constructor.
 
void iterate (Xtc *, const void *bufEnd)
 Call process() on each child xtc in root's payload, in order, until process() returns 0 or the payload is used up.
 
const Xtc * root () const
 Return the root xtc given to the constructor.
 

Detailed Description

Abstract iterator over the child xtcs of a root Xtc.

iterate() calls process() once per direct child and stops when it returns 0. It does not descend into children by itself; subclasses call iterate(child, bufEnd) from process() to do that.

Constructor & Destructor Documentation

◆ XtcIterator() [1/2]

XtcData::XtcIterator::XtcIterator ( Xtc *  root,
const void *  bufEnd 
)
inline

Store root and bufEnd for use by iterate().

◆ XtcIterator() [2/2]

XtcData::XtcIterator::XtcIterator ( )
inline

Default constructor; root and bufEnd are left uninitialized (use iterate(Xtc*, const void*)).

◆ ~XtcIterator()

virtual XtcData::XtcIterator::~XtcIterator ( )
inlinevirtual

Virtual destructor; does nothing.

Member Function Documentation

◆ iterate() [1/2]

void XtcData::XtcIterator::iterate ( )
inline

Call iterate(root, bufEnd) with the values given to the constructor.

◆ iterate() [2/2]

void XtcData::XtcIterator::iterate ( Xtc *  ,
const void *  bufEnd 
)

Call process() on each child xtc in root's payload, in order, until process() returns 0 or the payload is used up.

Returns at once if root's damage has the Damage::Corrupted bit set. Prints a message and calls abort() if a child starts at or past a non-null bufEnd or has extent < sizeof(Xtc).

◆ process()

virtual int XtcData::XtcIterator::process ( Xtc *  xtc,
const void *  bufEnd 
)
pure virtual

Called by iterate() for each child xtc; return 0 to stop iterating, nonzero to continue.

Pure virtual.

Implemented in XtcData::ConfigIter, XtcData::DataIter, XtcData::NamesIter, and XtcData::XtcUpdateIter.

◆ root()

const XtcData::Xtc * XtcData::XtcIterator::root ( ) const
inline

Return the root xtc given to the constructor.


The documentation for this class was generated from the following file: