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

Description of one data field: an Alg, a name (char[MaxNameSize]), a DataType and a rank. More...

#include <ShapesData.hh>

Public Types

enum  DataType {
  UINT8 , UINT16 , UINT32 , UINT64 ,
  INT8 , INT16 , INT32 , INT64 ,
  FLOAT , DOUBLE , CHARSTR , ENUMVAL ,
  ENUMDICT
}
 Element type of a field. More...
 

Public Member Functions

 Name (const char *name, DataType type, int rank=0)
 Field with the given name, type and rank, and an empty Alg ("", 0, 0, 0).
 
 Name (const char *name, DataType type, int rank, Alg &alg)
 Field with the given name, type, rank and alg.
 
 Name (const char *name, Alg &alg)
 Field with the given name and alg, type UINT8 and rank 1.
 
const char * name ()
 Return the field name.
 
DataType type ()
 Return the DataType.
 
uint32_t rank ()
 Return the rank.
 
Alg & alg ()
 Return a reference to the Alg.
 
const char * str_type ()
 Return the DataType as a string (e.g.
 

Static Public Member Functions

static int get_element_size (DataType type)
 Return the element size in bytes for type from the table in ShapesData.cc; type is not range-checked.
 

Detailed Description

Description of one data field: an Alg, a name (char[MaxNameSize]), a DataType and a rank.

A Names xtc stores an array of these after its header.

Member Enumeration Documentation

◆ DataType

Element type of a field.

Name::get_element_size() maps each value to a byte size using a table in ShapesData.cc.

Enumerator
UINT8 

Value 0; element size sizeof(uint8_t).

UINT16 

Value 1; element size sizeof(uint16_t).

UINT32 

Value 2; element size sizeof(uint32_t).

UINT64 

Value 3; element size sizeof(uint64_t).

INT8 

Value 4; element size sizeof(int8_t).

INT16 

Value 5; element size sizeof(int16_t).

INT32 

Value 6; element size sizeof(int32_t).

INT64 

Value 7; element size sizeof(int64_t).

FLOAT 

Value 8; element size sizeof(float).

DOUBLE 

Value 9; element size sizeof(double).

CHARSTR 

Value 10; element size sizeof(char).

ENUMVAL 

Value 11; element size sizeof(int32_t).

ENUMDICT 

Value 12; element size sizeof(int32_t).

Constructor & Destructor Documentation

◆ Name() [1/3]

XtcData::Name::Name ( const char *  name,
DataType  type,
int  rank = 0 
)
inline

Field with the given name, type and rank, and an empty Alg ("", 0, 0, 0).

Aborts with a message if rank >= MaxRank, if strlen(name) >= MaxNameSize, or if name has a character other than letters, digits, '_', '.' or ':'.

◆ Name() [2/3]

XtcData::Name::Name ( const char *  name,
DataType  type,
int  rank,
Alg &  alg 
)
inline

Field with the given name, type, rank and alg.

Aborts with a message if rank >= MaxRank, if strlen(name) >= MaxNameSize, or if name has a character other than letters, digits, '_', '.' or ':'.

◆ Name() [3/3]

XtcData::Name::Name ( const char *  name,
Alg &  alg 
)
inline

Field with the given name and alg, type UINT8 and rank 1.

Aborts with a message if strlen(name) >= MaxNameSize or if name has a character other than letters, digits, '_', '.' or ':'.

Member Function Documentation

◆ alg()

Alg & XtcData::Name::alg ( )
inline

Return a reference to the Alg.

◆ get_element_size()

static int XtcData::Name::get_element_size ( DataType  type)
static

Return the element size in bytes for type from the table in ShapesData.cc; type is not range-checked.

◆ name()

const char * XtcData::Name::name ( )
inline

Return the field name.

◆ rank()

uint32_t XtcData::Name::rank ( )
inline

Return the rank.

◆ str_type()

const char * XtcData::Name::str_type ( )

Return the DataType as a string (e.g.

"UINT8"), or nullptr for a value outside the enum.

◆ type()

DataType XtcData::Name::type ( )
inline

Return the DataType.


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