11 #ifndef EVIO_6_0_BLOCKHEADERV4_H
12 #define EVIO_6_0_BLOCKHEADERV4_H
221 void copy(std::shared_ptr<BlockHeaderV4> & blkHeader) {
222 size = blkHeader->size;
223 number = blkHeader->number;
247 throw EvioException(
"Bad value for size in block (physical record) header: " + std::to_string(sz));
271 throw EvioException(
"Bad value for event count in block (physical record) header: " +
272 std::to_string(count));
311 std::cout <<
"Warning: Block Header Length = " <<
headerLength << std::endl;
427 for (uint32_t i=0; i < 4; i++) {
429 if (bitisSet) type |= (uint32_t)1 << i;
483 void setBit(uint32_t bitIndex,
bool value) {
501 if (type < 0) type = 0;
502 else if (type > 15) type = 15;
504 for (uint32_t i=2; i < 6; i++) {
505 bSet[i] = ((type >> (i-2)) & 0x1) > 0;
519 for (uint32_t i=0; i <
bitInfo.size(); i++) {
539 for (uint32_t i=0; i < set.size(); i++) {
565 for (uint32_t i=0; i < bSet.size(); i++) {
574 v = hasDictionary ? (v | 0x100) : v;
575 v = isEnd ? (v | 0x200) : v;
594 bool isEnd, uint32_t eventType) {
596 v = hasDictionary ? (v | 0x100) : v;
597 v = isEnd ? (v | 0x200) : v;
598 v |= ((eventType & 0xf) << 10);
618 bool isEnd, uint32_t eventType) {
621 for (
int i=0; i < bSet.size(); i++) {
630 v = hasDictionary ? (v | 0x100) : v;
631 v = isEnd ? (v | 0x200) : v;
632 v |= ((eventType & 0xf) << 10);
644 for (
int i=0; i <
bitInfo.size(); i++) {
645 bitInfo[i] = ((word >> (8+i)) & 0x1) > 0;
701 throw EvioException(
"Value for magicNumber, " + std::to_string(magicNum) +
702 " does not match MAGIC_NUMBER 0xc0da0100");
721 std::stringstream ss;
723 ss <<
"block size: " <<
size << std::endl;
724 ss <<
"number: " <<
number << std::endl;
726 ss <<
"event count: " <<
eventCount << std::endl;
727 ss <<
"reserved1: " <<
reserved1 << std::endl;
728 ss <<
"bitInfo bits: " <<
bitInfo.to_string() << std::endl;
732 ss <<
"is last blk: " <<
isLastBlock() << std::endl;
734 ss <<
"version: " <<
version << std::endl;
766 throw EvioException(
"Provided position is less than buffer starting position.");
770 if (position > nextBufferStart) {
771 throw EvioException(
"Provided position beyond buffer end position.");
774 return nextBufferStart - position;
781 throw std::overflow_error(
"not enough room in buffer to write");
799 #endif //EVIO_6_0_BLOCKHEADERV4_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