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

The createXXX methods exist is in the EventParser class in the original Java, but must be moved in C++ to avoid a circular reference to BaseStructure. More...

#include <EventHeaderParser.h>

Static Public Member Functions

static std::shared_ptr
< BankHeader
createBankHeader (uint8_t *bytes, ByteOrder const &byteOrder)
 Create a bank header from the first eight bytes of the data array. More...
 
static std::shared_ptr
< SegmentHeader
createSegmentHeader (uint8_t *bytes, ByteOrder const &byteOrder)
 Create a segment header from the first four bytes of the data array. More...
 
static std::shared_ptr
< TagSegmentHeader
createTagSegmentHeader (uint8_t *bytes, ByteOrder const &byteOrder)
 Create a tag segment header from the first four bytes of the data array. More...
 
static void swapBankHeader (std::shared_ptr< EvioNode > &node, std::shared_ptr< ByteBuffer > &srcBuffer, std::shared_ptr< ByteBuffer > &destBuffer, uint32_t srcPos, uint32_t destPos)
 This method reads and swaps an evio bank header. More...
 
static void swapBankHeader (EvioNode &node, ByteBuffer &srcBuffer, ByteBuffer &destBuffer, uint32_t srcPos, uint32_t destPos)
 This method reads and swaps an evio bank header. More...
 
static void swapSegmentHeader (std::shared_ptr< EvioNode > &node, std::shared_ptr< ByteBuffer > &srcBuffer, std::shared_ptr< ByteBuffer > &destBuffer, uint32_t srcPos, uint32_t destPos)
 This method reads and swaps an evio segment header. More...
 
static void swapSegmentHeader (EvioNode &node, ByteBuffer &srcBuffer, ByteBuffer &destBuffer, uint32_t srcPos, uint32_t destPos)
 This method reads and swaps an evio segment header. More...
 
static void swapTagSegmentHeader (std::shared_ptr< EvioNode > &node, std::shared_ptr< ByteBuffer > &srcBuffer, std::shared_ptr< ByteBuffer > &destBuffer, uint32_t srcPos, uint32_t destPos)
 This method reads and swaps an evio tagsegment header. More...
 
static void swapTagSegmentHeader (EvioNode &node, ByteBuffer &srcBuffer, ByteBuffer &destBuffer, uint32_t srcPos, uint32_t destPos)
 This method reads and swaps an evio tagsegment header. More...
 

Detailed Description

The createXXX methods exist is in the EventParser class in the original Java, but must be moved in C++ to avoid a circular reference to BaseStructure.

Also methods for swapping headers was moved here from Java's ByteDataTransformer class. Although they would fit in the Util class, it seems more appropriate to put them here.

Author
heddle (original java in EventParser & ByteDataTransformer classes)
timmer
Date
5/27/2020

Member Function Documentation

static std::shared_ptr<BankHeader> evio::EventHeaderParser::createBankHeader ( uint8_t *  bytes,
ByteOrder const &  byteOrder 
)
inlinestatic

Create a bank header from the first eight bytes of the data array.

Parameters
bytesthe byte array, probably from a bank that encloses this new bank.
byteOrderbyte order of array, ByteOrder#ENDIAN_BIG or ByteOrder#ENDIAN_LITTLE.
Exceptions
EvioExceptionif data not in evio format.
Returns
the new bank header.

References evio::Util::toIntArray().

Referenced by evio::CompositeData::parse(), and evio::CompositeData::swapAll().

static std::shared_ptr<SegmentHeader> evio::EventHeaderParser::createSegmentHeader ( uint8_t *  bytes,
ByteOrder const &  byteOrder 
)
inlinestatic

Create a segment header from the first four bytes of the data array.

Parameters
bytesthe byte array, probably from a bank that encloses this new segment.
byteOrderbyte order of array, ByteOrder#ENDIAN_BIG or ByteOrder#ENDIAN_LITTLE.
Exceptions
EvioExceptionif data not in evio format.
Returns
the new segment header.

References evio::Util::toIntArray().

static std::shared_ptr<TagSegmentHeader> evio::EventHeaderParser::createTagSegmentHeader ( uint8_t *  bytes,
ByteOrder const &  byteOrder 
)
inlinestatic

Create a tag segment header from the first four bytes of the data array.

Parameters
bytesthe byte array, probably from a bank that encloses this new tag segment.
byteOrderbyte order of array, ByteOrder#ENDIAN_BIG or ByteOrder#ENDIAN_LITTLE.
Exceptions
EvioExceptionif data not in evio format.
Returns
the new tagsegment header.

References evio::Util::toIntArray().

Referenced by evio::CompositeData::parse(), and evio::CompositeData::swapAll().

static void evio::EventHeaderParser::swapBankHeader ( std::shared_ptr< EvioNode > &  node,
std::shared_ptr< ByteBuffer > &  srcBuffer,
std::shared_ptr< ByteBuffer > &  destBuffer,
uint32_t  srcPos,
uint32_t  destPos 
)
inlinestatic

This method reads and swaps an evio bank header.

It can also return information about the bank. Position and limit of neither buffer argument is changed.

This only swaps data if buffer arguments have opposite byte order!

Parameters
nodeobject in which to store data about the bank in destBuffer after swap.
srcBufferbuffer containing bank header to be swapped.
destBufferbuffer in which to place swapped bank header.
srcPosposition in srcBuffer to start reading bank header.
destPosposition in destBuffer to start writing swapped bank header.
Exceptions
EvioExceptionif srcBuffer data underflow; if destBuffer is too small to contain swapped data; srcBuffer and destBuffer have same byte order.

Referenced by evio::CompositeData::swapAll().

static void evio::EventHeaderParser::swapBankHeader ( EvioNode node,
ByteBuffer srcBuffer,
ByteBuffer destBuffer,
uint32_t  srcPos,
uint32_t  destPos 
)
inlinestatic

This method reads and swaps an evio bank header.

It can also return information about the bank. Position and limit of neither buffer argument is changed.

This only swaps data if buffer arguments have opposite byte order!

Parameters
nodeobject in which to store data about the bank in destBuffer after swap.
srcBufferbuffer containing bank header to be swapped.
destBufferbuffer in which to place swapped bank header.
srcPosposition in srcBuffer to start reading bank header.
destPosposition in destBuffer to start writing swapped bank header.
Exceptions
EvioExceptionif srcBuffer data underflow; if destBuffer is too small to contain swapped data; srcBuffer and destBuffer have same byte order.

References evio::ByteBuffer::getInt(), evio::ByteBuffer::order(), and evio::ByteBuffer::putInt().

static void evio::EventHeaderParser::swapSegmentHeader ( std::shared_ptr< EvioNode > &  node,
std::shared_ptr< ByteBuffer > &  srcBuffer,
std::shared_ptr< ByteBuffer > &  destBuffer,
uint32_t  srcPos,
uint32_t  destPos 
)
inlinestatic

This method reads and swaps an evio segment header.

It can also return information about the segment. Position and limit of neither buffer argument is changed.

This only swaps data if buffer arguments have opposite byte order!

Parameters
nodeobject in which to store data about the segment in destBuffer after swap; may be null
srcBufferbuffer containing segment header to be swapped
destBufferbuffer in which to place swapped segment header
srcPosposition in srcBuffer to start reading segment header
destPosposition in destBuffer to start writing swapped segment header
Exceptions
EvioExceptionif srcBuffer data underflow; if destBuffer is too small to contain swapped data; srcBuffer and destBuffer have same byte order.
static void evio::EventHeaderParser::swapSegmentHeader ( EvioNode node,
ByteBuffer srcBuffer,
ByteBuffer destBuffer,
uint32_t  srcPos,
uint32_t  destPos 
)
inlinestatic

This method reads and swaps an evio segment header.

It can also return information about the segment. Position and limit of neither buffer argument is changed.

This only swaps data if buffer arguments have opposite byte order!

Parameters
nodeobject in which to store data about the segment in destBuffer after swap; may be null
srcBufferbuffer containing segment header to be swapped
destBufferbuffer in which to place swapped segment header
srcPosposition in srcBuffer to start reading segment header
destPosposition in destBuffer to start writing swapped segment header
Exceptions
EvioExceptionif srcBuffer data underflow; if destBuffer is too small to contain swapped data; srcBuffer and destBuffer have same byte order.

References evio::ByteBuffer::getInt(), evio::ByteBuffer::order(), and evio::ByteBuffer::putInt().

static void evio::EventHeaderParser::swapTagSegmentHeader ( std::shared_ptr< EvioNode > &  node,
std::shared_ptr< ByteBuffer > &  srcBuffer,
std::shared_ptr< ByteBuffer > &  destBuffer,
uint32_t  srcPos,
uint32_t  destPos 
)
inlinestatic

This method reads and swaps an evio tagsegment header.

It can also return information about the tagsegment. Position and limit of neither buffer argument is changed.

This only swaps data if buffer arguments have opposite byte order!

Parameters
nodeobject in which to store data about the tagsegment in destBuffer after swap; may be null
srcBufferbuffer containing tagsegment header to be swapped
destBufferbuffer in which to place swapped tagsegment header
srcPosposition in srcBuffer to start reading tagsegment header
destPosposition in destBuffer to start writing swapped tagsegment header
Exceptions
EvioExceptionif srcBuffer is not properly formatted; if destBuffer is too small to contain swapped data

Referenced by evio::CompositeData::swapAll().

static void evio::EventHeaderParser::swapTagSegmentHeader ( EvioNode node,
ByteBuffer srcBuffer,
ByteBuffer destBuffer,
uint32_t  srcPos,
uint32_t  destPos 
)
inlinestatic

This method reads and swaps an evio tagsegment header.

It can also return information about the tagsegment. Position and limit of neither buffer argument is changed.

This only swaps data if buffer arguments have opposite byte order!

Parameters
nodeobject in which to store data about the tagsegment in destBuffer after swap; may be null
srcBufferbuffer containing tagsegment header to be swapped
destBufferbuffer in which to place swapped tagsegment header
srcPosposition in srcBuffer to start reading tagsegment header
destPosposition in destBuffer to start writing swapped tagsegment header
Exceptions
EvioExceptionif srcBuffer is not properly formatted; if destBuffer is too small to contain swapped data

References evio::ByteBuffer::getInt(), evio::ByteBuffer::order(), and evio::ByteBuffer::putInt().


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