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

XtcIterator subclass that stores pointers to ShapesData xtcs in a 2-entry array indexed by NamesId::namesId() (low 8 bits of the NamesId). More...

#include <DataIter.hh>

Inherits XtcData::XtcIterator.

Public Types

enum  { Stop , Continue }
 Return values of process(). More...
 

Public Member Functions

 DataIter (XtcData::Xtc *xtc, const void *bufEnd)
 Construct rooted at xtc and immediately call iterate(); bufEnd bounds the buffer (may be null).
 
 DataIter ()
 Default constructor; nothing is iterated and the ShapesData array is left uninitialized.
 
 ~DataIter ()
 Delete the DescData objects created by desc_shape() and desc_value().
 
virtual int process (XtcData::Xtc *xtc, const void *bufEnd)
 Iterate into TypeId::Parent xtcs and store each TypeId::ShapesData pointer at index NamesId::namesId(); other types (including Names) are ignored.
 
ShapesData & shape ()
 Return the ShapesData stored at index 0 (not checked to have been set).
 
ShapesData & value ()
 Return the ShapesData stored at index 1 (not checked to have been set).
 
DescData & desc_shape (NamesLookup &names_map)
 On the first call build a DescData from shape() and names_map[shape().namesId()]; later calls return the same cached object and ignore names_map.
 
DescData & desc_value (NamesLookup &names_map)
 On the first call build a DescData from value() and names_map[value().namesId()]; later calls return the same cached object and ignore names_map.
 
 DataIter (const DataIter &)=delete
 Copy construction is disabled.
 
DataIter & operator= (const DataIter &)=delete
 Copy assignment is disabled.
 
- Public Member Functions inherited from XtcData::XtcIterator
 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.
 
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

XtcIterator subclass that stores pointers to ShapesData xtcs in a 2-entry array indexed by NamesId::namesId() (low 8 bits of the NamesId).

The header comment says it gives access to data in datagrams of an xtc2 file.

Member Enumeration Documentation

◆ anonymous enum

Return values of process().

XtcIterator::iterate() stops when process() returns 0 (Stop).

Enumerator
Stop 

Value 0: stop iterating.

Continue 

Value 1: keep iterating.

Constructor & Destructor Documentation

◆ DataIter() [1/3]

XtcData::DataIter::DataIter ( XtcData::Xtc *  xtc,
const void *  bufEnd 
)
inline

Construct rooted at xtc and immediately call iterate(); bufEnd bounds the buffer (may be null).

◆ DataIter() [2/3]

XtcData::DataIter::DataIter ( )
inline

Default constructor; nothing is iterated and the ShapesData array is left uninitialized.

◆ ~DataIter()

XtcData::DataIter::~DataIter ( )

Delete the DescData objects created by desc_shape() and desc_value().

◆ DataIter() [3/3]

XtcData::DataIter::DataIter ( const DataIter &  )
delete

Copy construction is disabled.

Member Function Documentation

◆ desc_shape()

DescData & XtcData::DataIter::desc_shape ( NamesLookup &  names_map)

On the first call build a DescData from shape() and names_map[shape().namesId()]; later calls return the same cached object and ignore names_map.

The object is owned by this DataIter and freed by the destructor.

◆ desc_value()

DescData & XtcData::DataIter::desc_value ( NamesLookup &  names_map)

On the first call build a DescData from value() and names_map[value().namesId()]; later calls return the same cached object and ignore names_map.

The object is owned by this DataIter and freed by the destructor.

◆ operator=()

DataIter & XtcData::DataIter::operator= ( const DataIter &  )
delete

Copy assignment is disabled.

◆ process()

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

Iterate into TypeId::Parent xtcs and store each TypeId::ShapesData pointer at index NamesId::namesId(); other types (including Names) are ignored.

There is no bounds check, so a namesId of 2 or more writes past the 2-entry array.

Returns
Always Continue.

Implements XtcData::XtcIterator.

◆ shape()

ShapesData & XtcData::DataIter::shape ( )
inline

Return the ShapesData stored at index 0 (not checked to have been set).

◆ value()

ShapesData & XtcData::DataIter::value ( )
inline

Return the ShapesData stored at index 1 (not checked to have been set).


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