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

Make a common interface for different versions of the BlockHeader arising from different evio versions. More...

#include <IBlockHeader.h>

Public Member Functions

virtual uint32_t getSize ()=0
 Get the size of the block (record) in 32 bit words. More...
 
virtual uint32_t getNumber ()=0
 Get the block number for this block (record). More...
 
virtual uint32_t getHeaderWords ()=0
 Get the block (record) header length, in 32 bit words. More...
 
virtual uint32_t getSourceId ()=0
 Get the source ID number if in CODA online context and data is coming from ROC. More...
 
virtual bool hasFirstEvent ()=0
 Does this block/record contain the "first event" (first event to be written to each file split)? More...
 
virtual uint32_t getEventType ()=0
 Get the type of events in block/record (see values of DataType. More...
 
virtual uint32_t getVersion ()=0
 Get the evio version of the block (record) header. More...
 
virtual uint32_t getMagicNumber ()=0
 Get the magic number the block (record) header which should be 0xc0da0100. More...
 
virtual ByteOrdergetByteOrder ()=0
 Get the byte order of the data being read. More...
 
virtual size_t getBufferEndingPosition ()=0
 Get the position in the buffer (bytes) of this block's last data word. More...
 
virtual size_t getBufferStartingPosition ()=0
 Get the starting position in the buffer (bytes) from which this header was read–if that happened. More...
 
virtual void setBufferStartingPosition (size_t pos)=0
 Set the starting position in the buffer (bytes) from which this header was read–if that happened. More...
 
virtual size_t nextBufferStartingPosition ()=0
 Determines where the start of the next block (record) header in some buffer is located (bytes). More...
 
virtual size_t firstEventStartingPosition ()=0
 Determines where the start of the first event in this block (record) is located (bytes). More...
 
virtual size_t bytesRemaining (size_t position)=0
 Gives the bytes remaining in this block (record) given a buffer position. More...
 
virtual bool hasDictionary ()=0
 Does this block contain an evio dictionary? More...
 
virtual bool isLastBlock ()=0
 Is this the last block in the file or being sent over the network? More...
 
virtual bool isCompressed ()=0
 Is this the data in this block compressed? More...
 
virtual Compressor::CompressionType getCompressionType ()=0
 Get the type of data compression used. More...
 
virtual size_t write (ByteBuffer &byteBuffer)=0
 Write myself out into a byte buffer. More...
 
virtual std::string toString ()=0
 Get the string representation of the block (record) header. More...
 

Static Public Attributes

static const uint32_t MAGIC_NUMBER = 0xc0da0100
 The magic number, should be the value of magicNumber. More...
 
static const uint32_t MAGIC_OFFSET = 28
 Byte offset from beginning of header to the magic number. More...
 
static const uint32_t BIT_INFO_OFFSET = 20
 Byte offset from beginning of header to bit info word. More...
 
static const uint32_t VERSION_MASK = 0xff
 Mask to get version number from bitinfo word in header. More...
 

Detailed Description

Make a common interface for different versions of the BlockHeader arising from different evio versions.

In evio version 4 and later, blocks are called records.

Date
06/5/2020
Author
timmer

Member Function Documentation

virtual size_t evio::IBlockHeader::bytesRemaining ( size_t  position)
pure virtual

Gives the bytes remaining in this block (record) given a buffer position.

The position is an absolute position in a byte buffer. This assumes that the absolute position in bufferStartingPosition is being maintained properly by the reader.

Parameters
positionthe absolute current position in a byte buffer.
Returns
the number of bytes remaining in this block (record).
Exceptions
EvioExceptionif position out of bounds

Implemented in evio::BlockHeaderV4, evio::RecordHeader, and evio::BlockHeaderV2.

virtual size_t evio::IBlockHeader::firstEventStartingPosition ( )
pure virtual

Determines where the start of the first event in this block (record) is located (bytes).

This assumes the start position has been maintained by the object performing the buffer read.

Returns
where the start of the first event in this block (record) is located (bytes). In evio format version 2, returns 0 if start is 0, signaling that this entire record is part of a logical record that spans at least three physical records.

Implemented in evio::BlockHeaderV4, evio::RecordHeader, and evio::BlockHeaderV2.

virtual size_t evio::IBlockHeader::getBufferEndingPosition ( )
pure virtual

Get the position in the buffer (bytes) of this block's last data word.


Returns
position in the buffer (bytes) of this block's last data word.

Implemented in evio::BlockHeaderV4, evio::RecordHeader, and evio::BlockHeaderV2.

virtual size_t evio::IBlockHeader::getBufferStartingPosition ( )
pure virtual

Get the starting position in the buffer (bytes) from which this header was read–if that happened.


This is not part of the block header proper. It is a position in a memory buffer of the start of the block (record). It is kept for convenience. It is up to the reader to set it.

Returns
starting position in buffer (bytes) from which this header was read–if that happened.

Implemented in evio::BlockHeaderV4, evio::RecordHeader, and evio::BlockHeaderV2.

virtual ByteOrder& evio::IBlockHeader::getByteOrder ( )
pure virtual

Get the byte order of the data being read.

Returns
byte order of the data being read.

Implemented in evio::BlockHeaderV4, evio::RecordHeader, and evio::BlockHeaderV2.

virtual Compressor::CompressionType evio::IBlockHeader::getCompressionType ( )
pure virtual

Get the type of data compression used.

Returns
type of data compression used.

Implemented in evio::RecordHeader, evio::BlockHeaderV4, and evio::BlockHeaderV2.

virtual uint32_t evio::IBlockHeader::getEventType ( )
pure virtual

Get the type of events in block/record (see values of DataType.

This is not supported by versions 1-3 which returns 0.

Returns
type of events in block/record, or 0 if evio version 1-3.

Implemented in evio::RecordHeader, evio::BlockHeaderV4, and evio::BlockHeaderV2.

virtual uint32_t evio::IBlockHeader::getHeaderWords ( )
pure virtual

Get the block (record) header length, in 32 bit words.

Returns
block (record) header length, in 32 bit words.

Implemented in evio::RecordHeader, evio::BlockHeaderV2, and evio::BlockHeaderV4.

virtual uint32_t evio::IBlockHeader::getMagicNumber ( )
pure virtual

Get the magic number the block (record) header which should be 0xc0da0100.

Returns
magic number in the block (record).

Implemented in evio::BlockHeaderV4, evio::RecordHeader, and evio::BlockHeaderV2.

virtual uint32_t evio::IBlockHeader::getNumber ( )
pure virtual

Get the block number for this block (record).

In a file, this is usually sequential, starting at 1.

Returns
the block number for this block (record).

Implemented in evio::RecordHeader, evio::BlockHeaderV2, and evio::BlockHeaderV4.

virtual uint32_t evio::IBlockHeader::getSize ( )
pure virtual

Get the size of the block (record) in 32 bit words.

Returns
size of the block (record) in 32 bit words.

Implemented in evio::RecordHeader, evio::BlockHeaderV4, and evio::BlockHeaderV2.

virtual uint32_t evio::IBlockHeader::getSourceId ( )
pure virtual

Get the source ID number if in CODA online context and data is coming from ROC.

Returns
source ID number if in CODA online context and data is coming from ROC.

Implemented in evio::BlockHeaderV4, evio::RecordHeader, and evio::BlockHeaderV2.

virtual uint32_t evio::IBlockHeader::getVersion ( )
pure virtual

Get the evio version of the block (record) header.

Returns
evio version of the block (record) header.

Implemented in evio::RecordHeader, evio::BlockHeaderV2, and evio::BlockHeaderV4.

virtual bool evio::IBlockHeader::hasDictionary ( )
pure virtual

Does this block contain an evio dictionary?

Returns
true if this block contains an evio dictionary, else false. Always returns false for versions 1-3 (not implemented).

Implemented in evio::RecordHeader, evio::BlockHeaderV4, and evio::BlockHeaderV2.

virtual bool evio::IBlockHeader::hasFirstEvent ( )
pure virtual

Does this block/record contain the "first event" (first event to be written to each file split)?

Returns
true if this record has the first event, else false. Evio versions 1-3 always return false.

Implemented in evio::RecordHeader, evio::BlockHeaderV4, and evio::BlockHeaderV2.

virtual bool evio::IBlockHeader::isCompressed ( )
pure virtual

Is this the data in this block compressed?

Returns
true if the data in this block is compressed, else false.

Implemented in evio::RecordHeader, evio::BlockHeaderV4, and evio::BlockHeaderV2.

virtual bool evio::IBlockHeader::isLastBlock ( )
pure virtual

Is this the last block in the file or being sent over the network?

Returns
true if this is the last block in the file or being sent over the network, else false. Always returns false for versions 1-3 (not implemented).

Implemented in evio::RecordHeader, evio::BlockHeaderV4, and evio::BlockHeaderV2.

virtual size_t evio::IBlockHeader::nextBufferStartingPosition ( )
pure virtual

Determines where the start of the next block (record) header in some buffer is located (bytes).

This assumes the start position has been maintained by the object performing the buffer read.

Returns
the start of the next block (record) header in some buffer is located (bytes).

Implemented in evio::BlockHeaderV4, evio::RecordHeader, and evio::BlockHeaderV2.

virtual void evio::IBlockHeader::setBufferStartingPosition ( size_t  pos)
pure virtual

Set the starting position in the buffer (bytes) from which this header was read–if that happened.


This is not part of the block header proper. It is a position in a memory buffer of the start of the block (record). It is kept for convenience. It is up to the reader to set it.

Parameters
posstarting position in buffer from which this header was read–if that happened.

Implemented in evio::BlockHeaderV4, evio::RecordHeader, and evio::BlockHeaderV2.

virtual std::string evio::IBlockHeader::toString ( )
pure virtual

Get the string representation of the block (record) header.

Returns
string representation of the block (record) header.

Implemented in evio::BlockHeaderV4, evio::RecordHeader, and evio::BlockHeaderV2.

virtual size_t evio::IBlockHeader::write ( ByteBuffer byteBuffer)
pure virtual

Write myself out into 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.
Exceptions
overflow_errorif insufficient room to write header into buffer.

Implemented in evio::BlockHeaderV4, evio::RecordHeader, and evio::BlockHeaderV2.

Member Data Documentation

const uint32_t evio::IBlockHeader::BIT_INFO_OFFSET = 20
static

Byte offset from beginning of header to bit info word.

Referenced by evio::Util::findEvioVersion().

const uint32_t evio::IBlockHeader::MAGIC_NUMBER = 0xc0da0100
static
const uint32_t evio::IBlockHeader::MAGIC_OFFSET = 28
static

Byte offset from beginning of header to the magic number.

Referenced by evio::Util::findEvioVersion().

const uint32_t evio::IBlockHeader::VERSION_MASK = 0xff
static

Mask to get version number from bitinfo word in header.

Referenced by evio::Util::findEvioVersion().


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