|
lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
|
Writer that builds a ShapesData field by field: the constructor appends the ShapesData, a Shapes child with room for numArrays() Shape entries, and an empty Data child. More...
#include <DescData.hh>
Inherits XtcData::DescData.
Public Member Functions | |
| CreateData (Xtc &parent, const void *bufEnd, NamesLookup &NamesLookup, NamesId &namesId) | |
| Append to parent a ShapesData (src namesId) holding a Shapes child with room for names.numArrays() Shape entries and an empty Data child, using NamesLookup[namesId] as the NameIndex. | |
| CreateData (Xtc &parent, const void *bufEnd, NamesLookup &NamesLookup, VarDef &V, NamesId &namesId) | |
| Same as the four-argument constructor; V is not used. | |
| ~CreateData () | |
| Print a message and call abort() if the number of fields written differs from the number of Name entries in the Names. | |
| template<typename T > | |
| Array< T > | allocate (unsigned index, unsigned *shape) |
| Reserve array field index at the end of the Data payload and return an Array<T> view over it; the view's shape pointer is the caller's shape array. | |
| void | set_string (unsigned index, const char *xtcstring) |
| Append field index as a CHARSTR array holding xtcstring and its NUL terminator. | |
| template<typename T > | |
| void | set_value (unsigned index, T val) |
| Write val as scalar field index at the end of the Data payload and grow the Data, ShapesData and parent extents by sizeof(T). | |
| void * | get_ptr () |
| Return the address just past the Data child (its next()), where the next field would be written. | |
| void | set_array_shape (unsigned index, unsigned shape[MaxRank]) |
| Store shape as the next Shape entry for array field index, count the field as written, and grow the Data, ShapesData and parent extents by the array's byte size (Shape::size()). | |
Public Member Functions inherited from XtcData::DescData | |
| DescData (ShapesData &shapesdata, NameIndex &nameindex) | |
| Compute the field offsets for reading an existing shapesdata. | |
| DescData & | operator= (const DescData &o) |
| Copy offsets and counts from o. | |
| ~DescData () | |
| Destructor; does nothing. | |
| template<typename T > | |
| Array< T > | get_array (unsigned index) |
| Return an Array<T> view of field index: data at the field's offset in the Data payload, shape from shape(name), rank from the Name. | |
| template<class T > | |
| T | get_value (const char *name) |
| Look up name in the NameIndex's nameMap and return get_value<T>(index). | |
| template<class T > | |
| T | get_value (unsigned index) |
| Return a copy of the T stored at field index's offset in the Data payload. | |
| template<class T > | |
| T & | get_lvalue (unsigned index) |
| Return a reference to the T at field index's offset in the Data payload. | |
| uint32_t * | shape (Name &name) |
| Return the dimension array of the Shape at index shapeMap()[name.name()] in the Shapes child. | |
| NameIndex & | nameindex () |
| Return the NameIndex reference. | |
| ShapesData & | shapesdata () |
| Return the ShapesData reference. | |
| void | shapesdata (ShapesData &o) |
| Assign o into the referenced ShapesData (Xtc::operator=, which copies src, damage and contains and resets extent to sizeof(Xtc)); the reference is not rebound. | |
Additional Inherited Members | |
Static Public Member Functions inherited from XtcData::DescData | |
| static void | incorrectType (const char *file, unsigned line, Name &name) |
| Print file, line, and the type and name of name, then call abort(). | |
| static void | checkType (uint8_t val, Name &name) |
| Abort (incorrectType()) unless name.type() is UINT8; val only selects the overload. | |
| static void | checkType (uint16_t val, Name &name) |
| Abort (incorrectType()) unless name.type() is UINT16; val only selects the overload. | |
| static void | checkType (uint32_t val, Name &name) |
| Abort (incorrectType()) unless name.type() is UINT32, ENUMVAL or ENUMDICT; val only selects the overload. | |
| static void | checkType (uint64_t val, Name &name) |
| Abort (incorrectType()) unless name.type() is UINT64; val only selects the overload. | |
| static void | checkType (int8_t val, Name &name) |
| Abort (incorrectType()) unless name.type() is INT8; val only selects the overload. | |
| static void | checkType (int16_t val, Name &name) |
| Abort (incorrectType()) unless name.type() is INT16; val only selects the overload. | |
| static void | checkType (int32_t val, Name &name) |
| Abort (incorrectType()) unless name.type() is INT32, ENUMVAL or ENUMDICT; val only selects the overload. | |
| static void | checkType (int64_t val, Name &name) |
| Abort (incorrectType()) unless name.type() is INT64; val only selects the overload. | |
| static void | checkType (float val, Name &name) |
| Abort (incorrectType()) unless name.type() is FLOAT; val only selects the overload. | |
| static void | checkType (double val, Name &name) |
| Abort (incorrectType()) unless name.type() is DOUBLE; val only selects the overload. | |
| static void | checkType (char val, Name &name) |
| Abort (incorrectType()) unless name.type() is CHARSTR; val only selects the overload. | |
Protected Member Functions inherited from XtcData::DescData | |
| DescData (NameIndex &nameindex, Xtc &parent, const void *bufEnd, NamesId &namesId) | |
| DescData (NameIndex &nameindex, Xtc &parent, const void *bufEnd, VarDef &V, NamesId &namesId) | |
| void | set_array_shape (unsigned index, unsigned shapeIndex, const unsigned shape[MaxRank]) |
Protected Attributes inherited from XtcData::DescData | |
| std::vector< unsigned > | _offset |
| ShapesData & | _shapesdata |
| unsigned | _numentries |
| NameIndex & | _nameindex |
| unsigned | _numarrays |
Writer that builds a ShapesData field by field: the constructor appends the ShapesData, a Shapes child with room for numArrays() Shape entries, and an empty Data child.
set_value(), allocate() and set_string() then append fields; the destructor aborts if the number written differs from the Names count.
|
inline |
Append to parent a ShapesData (src namesId) holding a Shapes child with room for names.numArrays() Shape entries and an empty Data child, using NamesLookup[namesId] as the NameIndex.
Throws (from NameIndex::names()) if that entry holds no Names; a missing key is inserted empty.
|
inline |
Same as the four-argument constructor; V is not used.
|
inline |
Reserve array field index at the end of the Data payload and return an Array<T> view over it; the view's shape pointer is the caller's shape array.
Calls set_array_shape(index, shape), which stores the shape and grows the extents by the array's byte size. Aborts (checkType()) if T does not match the field's DataType; the field order is not checked.
|
inline |
Return the address just past the Data child (its next()), where the next field would be written.
Store shape as the next Shape entry for array field index, count the field as written, and grow the Data, ShapesData and parent extents by the array's byte size (Shape::size()).
Aborts if field index is a scalar (rank 0).
Append field index as a CHARSTR array holding xtcstring and its NUL terminator.
The array length is strlen + 1 rounded up to a multiple of 4, capped at the bytes left before bufEnd; aborts (checkType()) if the field is not CHARSTR.
Write val as scalar field index at the end of the Data payload and grow the Data, ShapesData and parent extents by sizeof(T).
Aborts with a message if index is not the next field in order, or (checkType()) if T does not match the field's DataType.