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

Builds a Dgram in a caller-supplied buffer by appending copies of pre-built Names, Shapes and Data blocks. More...

#include <BlockDgram.hh>

Inherits XtcData::Xtc.

Public Member Functions

 BlockDgram (uint8_t *buffdgram, size_t buffSize, uint64_t tstamp, unsigned control)
 Placement-construct a Dgram at buffdgram with time TimeStamp(tstamp), env control << 24, and an empty TypeId::Parent (version 0) xtc.
 
void addNamesBlock (uint8_t *name_block, size_t block_elems, unsigned nodeId, unsigned namesId)
 Append to the top-level xtc a TypeId::Names xtc (src NamesId(nodeId, namesId)) whose payload is a copy of sizeof(NameInfo) + block_elems*sizeof(Name) bytes from name_block.
 
void addShapesDataBlock (uint8_t *shape_block, uint8_t *data_block, size_t sizeofdata, size_t block_elems, unsigned nodeId, unsigned namesId)
 Append a TypeId::ShapesData xtc (src NamesId(nodeId, namesId)) holding a Shapes xtc and then a Data xtc.
 
void addDataBlock (uint8_t *data_block, size_t sizeofdata)
 Append a TypeId::ShapesData xtc with default src (0) holding only a Data xtc whose payload is sizeofdata bytes copied from data_block.
 
uint32_t dgramSize ()
 Return sizeof(Dgram) plus the top-level xtc's payload size, as updated by the constructor and each add*Block() call.
 
- Public Member Functions inherited from XtcData::Xtc
 Xtc ()
 Set damage and extent to 0; src gets the Src default (value 0) and contains is left uninitialized.
 
 Xtc (const Xtc &xtc)
 Copy src, damage and contains from xtc, but set extent to sizeof(Xtc) (empty payload).
 
 Xtc (const TypeId &type)
 Header of the given type with default Src (value 0), damage 0 and extent sizeof(Xtc).
 
 Xtc (const TypeId &type, const Src &_src)
 Header with the given type and src, damage 0 and extent sizeof(Xtc).
 
 Xtc (const TypeId &_tag, const Src &_src, unsigned _damage)
 Header with the given type (_tag), src and damage word, and extent sizeof(Xtc).
 
 Xtc (const TypeId &_tag, const Src &_src, const Damage &_damage)
 Header with the given type (_tag), src and damage, and extent sizeof(Xtc).
 
Xtc & operator= (const Xtc &xtc)
 Copy src, damage and contains from xtc and reset extent to sizeof(Xtc).
 
void * operator new (size_t size)
 Allocate size bytes with std::malloc.
 
void * operator new (size_t size, char *p, const void *end)
 Placement new at p.
 
void * operator new (size_t size, Xtc *p, const void *end)
 Placement new into the payload of p: returns p->alloc(size, end), which adds size to p's extent.
 
void * operator new (size_t size, Xtc &p, const void *end)
 Placement new into the payload of p: returns p.alloc(size, end), which adds size to p's extent.
 
void operator delete (void *p)
 Free p with std::free.
 
void operator delete (void *ptr, char *p, const void *end)
 Placement delete matching operator new(size_t, char*, const void*); does nothing.
 
void operator delete (void *ptr, Xtc *p, const void *end)
 Placement delete matching operator new(size_t, Xtc*, const void*); does nothing.
 
void operator delete (void *ptr, Xtc &p, const void *end)
 Placement delete matching operator new(size_t, Xtc&, const void*); does nothing.
 
char * payload () const
 Return a pointer to the first byte after this header.
 
int sizeofPayload () const
 Return extent - sizeof(Xtc) as an int (the comment above notes this limits extent to 31 bits).
 
Xtc * next ()
 Return the address extent bytes after the start of this header, where the next sibling Xtc begins.
 
const Xtc * next () const
 Return the address extent bytes after the start of this header, where the next sibling Xtc begins (const version).
 
void * alloc (size_t size, const void *end)
 Reserve size bytes at next() by adding size to extent and return that address (memory is not initialized).
 

Additional Inherited Members

- Public Attributes inherited from XtcData::Xtc
Src src
 Source word (Src); Names and ShapesData keep their NamesId here.
 
Damage damage
 Damage word.
 
TypeId contains
 TypeId (type and version) of the payload.
 
uint32_t extent
 Size in bytes of this header plus its payload.
 

Detailed Description

Builds a Dgram in a caller-supplied buffer by appending copies of pre-built Names, Shapes and Data blocks.

The comment above says it is used by cython. It derives from Xtc, but these methods do not use that base.

Constructor & Destructor Documentation

◆ BlockDgram()

XtcData::BlockDgram::BlockDgram ( uint8_t *  buffdgram,
size_t  buffSize,
uint64_t  tstamp,
unsigned  control 
)
inline

Placement-construct a Dgram at buffdgram with time TimeStamp(tstamp), env control << 24, and an empty TypeId::Parent (version 0) xtc.

buffdgram + buffSize is the end bound used by later alloc() calls, which abort if it would be passed.

Member Function Documentation

◆ addDataBlock()

void XtcData::BlockDgram::addDataBlock ( uint8_t *  data_block,
size_t  sizeofdata 
)
inline

Append a TypeId::ShapesData xtc with default src (0) holding only a Data xtc whose payload is sizeofdata bytes copied from data_block.

◆ addNamesBlock()

void XtcData::BlockDgram::addNamesBlock ( uint8_t *  name_block,
size_t  block_elems,
unsigned  nodeId,
unsigned  namesId 
)
inline

Append to the top-level xtc a TypeId::Names xtc (src NamesId(nodeId, namesId)) whose payload is a copy of sizeof(NameInfo) + block_elems*sizeof(Name) bytes from name_block.

◆ addShapesDataBlock()

void XtcData::BlockDgram::addShapesDataBlock ( uint8_t *  shape_block,
uint8_t *  data_block,
size_t  sizeofdata,
size_t  block_elems,
unsigned  nodeId,
unsigned  namesId 
)
inline

Append a TypeId::ShapesData xtc (src NamesId(nodeId, namesId)) holding a Shapes xtc and then a Data xtc.

The Shapes payload is sizeof(uint32_t) + block_elems*sizeof(Shape) bytes copied from shape_block; the Data payload is sizeofdata bytes copied from data_block.

◆ dgramSize()

uint32_t XtcData::BlockDgram::dgramSize ( )
inline

Return sizeof(Dgram) plus the top-level xtc's payload size, as updated by the constructor and each add*Block() call.


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