11 #ifndef EVIO_6_0_BLOCKHEADERV2_H
12 #define EVIO_6_0_BLOCKHEADERV2_H
94 uint32_t headerLength = 8;
113 uint32_t version = 2;
121 uint32_t reserved1 = 0;
133 uint64_t bufferStartingPosition = 0L;
177 void copy(std::shared_ptr<BlockHeaderV2> & blkHeader) {
178 size = blkHeader->size;
179 number = blkHeader->number;
180 headerLength = blkHeader->headerLength;
181 version = blkHeader->version;
182 end = blkHeader->end;
183 start = blkHeader->start;
184 reserved1 = blkHeader->reserved1;
185 byteOrder = blkHeader->byteOrder;
186 magicNumber = blkHeader->magicNumber;
187 bufferStartingPosition = blkHeader->bufferStartingPosition;
218 throw EvioException(
"Bad value for size in block (physical record) header: " + std::to_string(sz));
251 throw EvioException(
"Bad value for start in block (physical record) header: " + std::to_string(strt));
281 throw EvioException(
"Bad value for end in block (physical record) header: " + std::to_string(endd));
319 throw EvioException(
"Bad Block (Physical Record) Header Length: " + std::to_string(len));
378 throw EvioException(
"Value for magicNumber, " + std::to_string(magicNum) +
379 " does not match MAGIC_NUMBER 0xc0da0100");
398 std::stringstream ss;
400 ss <<
"block size: " << size << std::endl;
401 ss <<
"number: " << number << std::endl;
402 ss <<
"headerLen: " << headerLength << std::endl;
403 ss <<
"start: " << start << std::endl;
404 ss <<
"end: " << end << std::endl;
405 ss <<
"version: " << version << std::endl;
406 ss <<
"reserved1: " << reserved1 << std::endl;
407 ss <<
"magicNumber: " << magicNumber << std::endl;
436 return bufferStartingPosition + 4*start;
442 if (position < bufferStartingPosition) {
443 throw EvioException(
"Provided position is less than buffer starting position.");
447 if (position > nextBufferStart) {
448 throw EvioException(
"Provided position beyond buffer end position.");
451 return nextBufferStart - position;
459 throw std::overflow_error(
"not enough room in buffer to write");
462 byteBuffer.
putInt(number);
463 byteBuffer.
putInt(headerLength);
466 byteBuffer.
putInt(version);
467 byteBuffer.
putInt(reserved1);
468 byteBuffer.
putInt(magicNumber);
476 #endif //EVIO_6_0_BLOCKHEADERV2_H
This class is copied from one of the same name in the Java programming language.
Definition: ByteBuffer.h:42
size_t remaining() const
Returns the number of bytes from the current position to the end of the data.
Definition: ByteBuffer.cpp:497
CompressionType
Enum of supported data compression types.
Definition: Compressor.h:65
Numerical values associated with endian byte order.
Definition: ByteOrder.h:53
ByteBuffer & putInt(uint32_t val)
Relative put method for writing an int value.
Definition: ByteBuffer.cpp:1570
Exception class for Evio software package.
Definition: EvioException.h:29
Definition: Compressor.h:66
static const ByteOrder ENDIAN_LOCAL
Local host's byte order.
Definition: ByteOrder.h:61