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

16-bit word: bits 11:0 hold the Type, bits 15:12 the version. More...

#include <TypeId.hh>

Public Types

enum  Type {
  Parent , ShapesData , Shapes , Data ,
  Names , NumberOf
}
 Payload types. More...
 

Public Member Functions

 TypeId ()
 Default constructor; the value is left uninitialized.
 
 TypeId (const TypeId &v)
 Copy the 16-bit value of v.
 
 TypeId (Type type, unsigned version)
 Set the value to ((version << 12) & 0xf000) | type, so only the low 4 bits of version are kept.
 
 TypeId (const char *)
 Parse a string of the form NAME_vDIGITS, where NAME is one of name()'s strings and DIGITS is the version number.
 
Type id () const
 Return bits 11:0 as a Type.
 
unsigned version () const
 Return bits 15:12.
 
unsigned value () const
 Return the full 16-bit value.
 

Static Public Member Functions

static const char * name (Type type)
 Return "Parent", "ShapesData", "Shapes", "Data" or "Names" for type, or "-Invalid-" if type >= NumberOf.
 

Detailed Description

16-bit word: bits 11:0 hold the Type, bits 15:12 the version.

Member Enumeration Documentation

◆ Type

Payload types.

Per the comment above, values are already recorded in xtc files, so new ones must be appended.

Enumerator
Parent 

Value 0.

NamesIter, ConfigIter and DataIter iterate into xtcs of this type.

ShapesData 

Value 1.

Set by the ShapesData constructor.

Shapes 

Value 2.

Set by the Shapes constructor.

Data 

Value 3.

Set by the Data constructor.

Names 

Value 4.

Set by the Names constructor; NamesIter reads xtcs of this type as Names.

NumberOf 

Value 5, the number of types; name() returns "-Invalid-" for values at or above it.

Constructor & Destructor Documentation

◆ TypeId() [1/4]

XtcData::TypeId::TypeId ( )
inline

Default constructor; the value is left uninitialized.

◆ TypeId() [2/4]

XtcData::TypeId::TypeId ( const TypeId &  v)
inline

Copy the 16-bit value of v.

◆ TypeId() [3/4]

XtcData::TypeId::TypeId ( Type  type,
unsigned  version 
)
inline

Set the value to ((version << 12) & 0xf000) | type, so only the low 4 bits of version are kept.

◆ TypeId() [4/4]

XtcData::TypeId::TypeId ( const char *  )

Parse a string of the form NAME_vDIGITS, where NAME is one of name()'s strings and DIGITS is the version number.

On a match the code computes (version << 16) | type, which the 16-bit storage truncates to just the type, so the parsed version is dropped (version() returns 0). If there is no "_v" suffix, the digits are missing or followed by other characters, or the name is unknown, the value is NumberOf.

Member Function Documentation

◆ id()

XtcData::TypeId::Type XtcData::TypeId::id ( ) const
inline

Return bits 11:0 as a Type.

◆ name()

static const char * XtcData::TypeId::name ( Type  type)
static

Return "Parent", "ShapesData", "Shapes", "Data" or "Names" for type, or "-Invalid-" if type >= NumberOf.

◆ value()

unsigned XtcData::TypeId::value ( ) const
inline

Return the full 16-bit value.

◆ version()

unsigned XtcData::TypeId::version ( ) const
inline

Return bits 15:12.


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