evio  6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
evio::BankHeader Class Reference

This the header for an evio bank structure (EvioBank). More...

#include <BankHeader.h>

Public Member Functions

 BankHeader ()=default
 
 BankHeader (uint16_t tag, DataType const &dataType, uint8_t num=0)
 Constructor. More...
 
uint32_t getDataLength () override
 Get the length of the structure's data in 32 bit ints (not counting the header words). More...
 
uint32_t getHeaderLength () override
 Get the length of the structure's header in ints. More...
 
std::string toString () override
 Obtain a string representation of the bank header. More...
 
size_t write (std::shared_ptr< ByteBuffer > &dest) override
 Write myself out a byte buffer. More...
 
size_t write (ByteBuffer &dest) override
 Write myself out a byte buffer. More...
 
size_t write (uint8_t *dest, ByteOrder const &order) override
 Write myself out as evio format data into the given byte array in the specified byte order. More...
 
uint8_t getNumber () const
 Get the number. More...
 
void setNumber (uint8_t number)
 Set the number. More...
 
uint32_t getDataTypeValue () const
 Get the data type for the structure. More...
 
void setDataType (uint32_t type)
 Set the numeric data type for the structure. More...
 
void setDataType (DataType const &type)
 Set the numeric data type for the structure. More...
 
DataType getDataType () const
 Returns the data type for data stored in this structure as a DataType enum. More...
 
std::string getDataTypeName () const
 Returns the data type as a string. More...
 
uint8_t getPadding () const
 Get the amount of padding bytes when storing short or byte data. More...
 
uint32_t getLength () const
 Get the length of the structure in 32 bit ints, not counting the length word. More...
 
void setLength (uint32_t len)
 Set the length of the structure in 32 bit ints, not counting the length word. More...
 
uint16_t getTag () const
 Get the structure tag. More...
 
void setTag (uint16_t tag)
 Set the structure tag. More...
 

Protected Member Functions

void setPadding (uint8_t pad)
 Set the amount of padding bytes when storing short or byte data. More...
 
void copy (std::shared_ptr< BaseStructureHeader > const &head)
 Method to copy data from the fiven header to this one. More...
 

Protected Attributes

uint32_t length = 0
 The length of the structure in 32-bit words. More...
 
uint32_t tag = 0
 The structure tag. More...
 
DataType dataType {DataType::UNKNOWN32}
 The data type of the structure. More...
 
uint8_t padding = 0
 The amount of padding bytes when storing short or byte data. More...
 
uint8_t number = 0
 The number represents an unsigned byte. More...
 

Friends

class EvioReader
 

Detailed Description

This the header for an evio bank structure (EvioBank).

It does not contain the raw data, just the header. Note: since an "event" is really just the outermost bank, this is also the header for an EvioEvent. Copied from the java class of identical name.

Author
heddle (original Java version)
timmer
Date
4/23/2020

Constructor & Destructor Documentation

evio::BankHeader::BankHeader ( )
default
evio::BankHeader::BankHeader ( uint16_t  tag,
DataType const &  dataType,
uint8_t  num = 0 
)

Constructor.

Parameters
tagthe tag for the bank header.
dataTypethe data type for the content of the bank.
numsometimes, but not necessarily, an ordinal enumeration.

References evio::BaseStructureHeader::length.

Member Function Documentation

void evio::BaseStructureHeader::copy ( std::shared_ptr< BaseStructureHeader > const &  head)
protectedinherited

Method to copy data from the fiven header to this one.

Parameters
headheader to copy data from (source).

References evio::BaseStructureHeader::dataType, evio::BaseStructureHeader::length, evio::BaseStructureHeader::number, evio::BaseStructureHeader::padding, and evio::BaseStructureHeader::tag.

uint32_t evio::BankHeader::getDataLength ( )
overridevirtual

Get the length of the structure's data in 32 bit ints (not counting the header words).

Returns
Get the length of the structure's data in 32 bit ints (not counting the header words).

Reimplemented from evio::BaseStructureHeader.

References evio::BaseStructureHeader::length.

DataType evio::BaseStructureHeader::getDataType ( ) const
inherited

Returns the data type for data stored in this structure as a DataType enum.

Returns
the data type for data stored in this structure as a DataType enum.
See Also
DataType

References evio::BaseStructureHeader::dataType.

std::string evio::BaseStructureHeader::getDataTypeName ( ) const
inherited

Returns the data type as a string.

Returns
the data type as a string.

References evio::BaseStructureHeader::dataType, and evio::DataType::getName().

Referenced by evio::SegmentHeader::toString(), evio::TagSegmentHeader::toString(), and toString().

uint32_t evio::BaseStructureHeader::getDataTypeValue ( ) const
inherited

Get the data type for the structure.

Returns
the data type for the structure.

References evio::BaseStructureHeader::dataType, and evio::DataType::getValue().

uint32_t evio::BankHeader::getHeaderLength ( )
overridevirtual

Get the length of the structure's header in ints.

This includes the first header word itself (which contains the length) and in the case of banks, it also includes the second header word.

Returns
Get the length of the structure's header in ints.

Reimplemented from evio::BaseStructureHeader.

uint32_t evio::BaseStructureHeader::getLength ( ) const
inherited

Get the length of the structure in 32 bit ints, not counting the length word.

Returns
Get the length of the structure in 32 bit ints (not counting the length word).

References evio::BaseStructureHeader::length.

uint8_t evio::BaseStructureHeader::getNumber ( ) const
inherited

Get the number.

Only Banks have a number field in their header, so this is only relevant for Banks.

Returns
the number.

References evio::BaseStructureHeader::number.

uint8_t evio::BaseStructureHeader::getPadding ( ) const
inherited

Get the amount of padding bytes when storing short or byte data.

Value is 0, 1, 2, or 3 for bytes and 0 or 2 for shorts.

Returns
number of padding bytes

References evio::BaseStructureHeader::padding.

uint16_t evio::BaseStructureHeader::getTag ( ) const
inherited

Get the structure tag.

Returns
the structure tag.

References evio::BaseStructureHeader::tag.

void evio::BaseStructureHeader::setDataType ( uint32_t  type)
inherited

Set the numeric data type for the structure.

Parameters
typethe numeric data type for the structure.

References evio::BaseStructureHeader::dataType, and evio::DataType::getDataType().

void evio::BaseStructureHeader::setDataType ( DataType const &  type)
inherited

Set the numeric data type for the structure.

Parameters
typethe numeric data type for the structure.

References evio::BaseStructureHeader::dataType.

void evio::BaseStructureHeader::setLength ( uint32_t  len)
inherited

Set the length of the structure in 32 bit ints, not counting the length word.

Parameters
lenthe length of the structure in 32 bit ints, not counting the length word.

References evio::BaseStructureHeader::length.

void evio::BaseStructureHeader::setNumber ( uint8_t  num)
inherited

Set the number.

Only Banks have a number field in their header, so this is only relevant for Banks.

Parameters
numthe number.

References evio::BaseStructureHeader::number.

void evio::BaseStructureHeader::setPadding ( uint8_t  pad)
protectedinherited

Set the amount of padding bytes when storing short or byte data.

Allowed value is 0, 1, 2, or 3 for bytes and 0 or 2 for shorts.

Parameters
padamount of padding bytes when storing short or byte data (0-3).

References evio::BaseStructureHeader::padding.

void evio::BaseStructureHeader::setTag ( uint16_t  t)
inherited

Set the structure tag.

Parameters
tthe structure tag.

References evio::BaseStructureHeader::tag.

std::string evio::BankHeader::toString ( )
overridevirtual

Obtain a string representation of the bank header.

Returns
a string representation of the bank header.

Reimplemented from evio::BaseStructureHeader.

References evio::BaseStructureHeader::getDataTypeName(), evio::BaseStructureHeader::length, evio::BaseStructureHeader::number, evio::BaseStructureHeader::padding, and evio::BaseStructureHeader::tag.

size_t evio::BankHeader::write ( std::shared_ptr< ByteBuffer > &  byteBuffer)
overridevirtual

Write myself out a byte buffer.

This write is relative - i.e., it uses the current position of the buffer.

Parameters
byteBufferthe byteBuffer to write to.
Returns
the number of bytes written, which for a BankHeader is 8.

Reimplemented from evio::BaseStructureHeader.

size_t evio::BankHeader::write ( ByteBuffer dest)
overridevirtual

Write myself out a byte buffer.

This write is relative - i.e., it uses the current position of the buffer.

Parameters
destthe byteBuffer to write to.
Returns
the number of bytes written, which for a BankHeader is 8.

Reimplemented from evio::BaseStructureHeader.

References evio::BaseStructureHeader::dataType, evio::DataType::getValue(), evio::BaseStructureHeader::length, evio::BaseStructureHeader::number, evio::BaseStructureHeader::padding, evio::ByteBuffer::putInt(), and evio::BaseStructureHeader::tag.

size_t evio::BankHeader::write ( uint8_t *  dest,
ByteOrder const &  order 
)
overridevirtual

Write myself out as evio format data into the given byte array in the specified byte order.

Parameters
destarray into which evio data is written (destination).
orderbyte order in which to write the data.
Returns
the number of bytes written, which for a BankHeader is 8.
Exceptions
EvioExceptionif destination array too small to hold data.

Reimplemented from evio::BaseStructureHeader.

References evio::BaseStructureHeader::dataType, evio::DataType::getValue(), evio::BaseStructureHeader::length, evio::BaseStructureHeader::number, evio::BaseStructureHeader::padding, evio::BaseStructureHeader::tag, and evio::Util::toBytes().

Friends And Related Function Documentation

friend class EvioReader
friend

Member Data Documentation

uint8_t evio::BaseStructureHeader::number = 0
protectedinherited

The number represents an unsigned byte.

Only Banks have a number field in their header, so this is only relevant for Banks.

Referenced by evio::BaseStructureHeader::BaseStructureHeader(), evio::BaseStructureHeader::copy(), evio::BaseStructureHeader::getNumber(), evio::BaseStructureHeader::setNumber(), toString(), and write().

uint8_t evio::BaseStructureHeader::padding = 0
protectedinherited

The amount of padding bytes when storing short or byte data.

Allowed value is 0, 1, 2, or 3 (0,2 for shorts and 0-3 for bytes) and is stored in the upper 2 bits of the dataType when written out.

Referenced by evio::BaseStructureHeader::copy(), evio::BaseStructureHeader::getPadding(), evio::BaseStructureHeader::setPadding(), evio::SegmentHeader::toString(), toString(), evio::SegmentHeader::write(), and write().


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