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

Container header, packed with 2-byte alignment: src (Src, 4 bytes), damage (Damage, 2 bytes), contains (TypeId, 2 bytes), extent (uint32_t). More...

#include <Xtc.hh>

Inherited by XtcData::AutoParentAlloc, XtcData::BlockDgram, and XtcData::ShapesData.

Public Member Functions

 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).
 

Public Attributes

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

Container header, packed with 2-byte alignment: src (Src, 4 bytes), damage (Damage, 2 bytes), contains (TypeId, 2 bytes), extent (uint32_t).

extent is the size in bytes of this header plus its payload; the payload starts right after the header (payload()) and the next sibling starts extent bytes after the header (next()).

Constructor & Destructor Documentation

◆ Xtc() [1/6]

XtcData::Xtc::Xtc ( )
inline

Set damage and extent to 0; src gets the Src default (value 0) and contains is left uninitialized.

◆ Xtc() [2/6]

XtcData::Xtc::Xtc ( const Xtc &  xtc)
inline

Copy src, damage and contains from xtc, but set extent to sizeof(Xtc) (empty payload).

◆ Xtc() [3/6]

XtcData::Xtc::Xtc ( const TypeId &  type)
inline

Header of the given type with default Src (value 0), damage 0 and extent sizeof(Xtc).

◆ Xtc() [4/6]

XtcData::Xtc::Xtc ( const TypeId &  type,
const Src &  _src 
)
inline

Header with the given type and src, damage 0 and extent sizeof(Xtc).

◆ Xtc() [5/6]

XtcData::Xtc::Xtc ( const TypeId &  _tag,
const Src &  _src,
unsigned  _damage 
)
inline

Header with the given type (_tag), src and damage word, and extent sizeof(Xtc).

◆ Xtc() [6/6]

XtcData::Xtc::Xtc ( const TypeId &  _tag,
const Src &  _src,
const Damage &  _damage 
)
inline

Header with the given type (_tag), src and damage, and extent sizeof(Xtc).

Member Function Documentation

◆ alloc()

void * XtcData::Xtc::alloc ( size_t  size,
const void *  end 
)
inline

Reserve size bytes at next() by adding size to extent and return that address (memory is not initialized).

Aborts with a message if end is non-null and the reserved bytes would pass end.

◆ next() [1/2]

Xtc * XtcData::Xtc::next ( )
inline

Return the address extent bytes after the start of this header, where the next sibling Xtc begins.

◆ next() [2/2]

const Xtc * XtcData::Xtc::next ( ) const
inline

Return the address extent bytes after the start of this header, where the next sibling Xtc begins (const version).

◆ operator delete() [1/4]

void XtcData::Xtc::operator delete ( void *  p)
inline

Free p with std::free.

◆ operator delete() [2/4]

void XtcData::Xtc::operator delete ( void *  ptr,
char *  p,
const void *  end 
)
inline

Placement delete matching operator new(size_t, char*, const void*); does nothing.

◆ operator delete() [3/4]

void XtcData::Xtc::operator delete ( void *  ptr,
Xtc &  p,
const void *  end 
)
inline

Placement delete matching operator new(size_t, Xtc&, const void*); does nothing.

◆ operator delete() [4/4]

void XtcData::Xtc::operator delete ( void *  ptr,
Xtc *  p,
const void *  end 
)
inline

Placement delete matching operator new(size_t, Xtc*, const void*); does nothing.

◆ operator new() [1/4]

void * XtcData::Xtc::operator new ( size_t  size)
inline

Allocate size bytes with std::malloc.

◆ operator new() [2/4]

void * XtcData::Xtc::operator new ( size_t  size,
char *  p,
const void *  end 
)
inline

Placement new at p.

Aborts with a message if end is non-null and p + size would pass end.

◆ operator new() [3/4]

void * XtcData::Xtc::operator new ( size_t  size,
Xtc &  p,
const void *  end 
)
inline

Placement new into the payload of p: returns p.alloc(size, end), which adds size to p's extent.

◆ operator new() [4/4]

void * XtcData::Xtc::operator new ( size_t  size,
Xtc *  p,
const void *  end 
)
inline

Placement new into the payload of p: returns p->alloc(size, end), which adds size to p's extent.

◆ operator=()

Xtc & XtcData::Xtc::operator= ( const Xtc &  xtc)
inline

Copy src, damage and contains from xtc and reset extent to sizeof(Xtc).

Returns
*this.

◆ payload()

char * XtcData::Xtc::payload ( ) const
inline

Return a pointer to the first byte after this header.

◆ sizeofPayload()

int XtcData::Xtc::sizeofPayload ( ) const
inline

Return extent - sizeof(Xtc) as an int (the comment above notes this limits extent to 31 bits).

Member Data Documentation

◆ contains

TypeId XtcData::Xtc::contains

TypeId (type and version) of the payload.

◆ damage

Damage XtcData::Xtc::damage

Damage word.

◆ extent

uint32_t XtcData::Xtc::extent

Size in bytes of this header plus its payload.

◆ src

Src XtcData::Xtc::src

Source word (Src); Names and ShapesData keep their NamesId here.


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