11 #ifndef EVIO_6_0_EVENTHEADERPARSER_H
12 #define EVIO_6_0_EVENTHEADERPARSER_H
55 std::shared_ptr<BankHeader> header = std::make_shared<BankHeader>();
61 header->setLength(len);
68 header->setTag(word >> 16);
69 int dt = (word >> 8) & 0xff;
71 uint8_t padding = dt >> 6;
72 header->setDataType(type);
73 header->setPadding(padding);
74 header->setNumber(word);
91 std::shared_ptr<SegmentHeader> header = std::make_shared<SegmentHeader>();
97 uint32_t len = word & 0xffff;
98 header->setLength(len);
100 int dt = (word >> 16) & 0xff;
101 int type = dt & 0x3f;
102 int padding = dt >> 6;
103 header->setDataType(type);
104 header->setPadding(padding);
105 header->setTag(word >> 24);
122 std::shared_ptr<TagSegmentHeader> header = std::make_shared<TagSegmentHeader>();
128 uint32_t len = word & 0xffff;
129 header->setLength(len);
130 header->setDataType((word >> 16) & 0xf);
131 header->setTag(word >> 20);
155 std::shared_ptr<ByteBuffer> & srcBuffer,
156 std::shared_ptr<ByteBuffer> & destBuffer,
157 uint32_t srcPos, uint32_t destPos) {
158 swapBankHeader(*(node.get()), *(srcBuffer.get()), *(destBuffer.get()), srcPos, destPos);
180 uint32_t srcPos, uint32_t destPos) {
183 if (srcBuffer.
order() == destBuffer.
order()) {
188 uint32_t length = srcBuffer.
getInt(srcPos);
189 destBuffer.
putInt(destPos, length);
194 uint32_t word = srcBuffer.
getInt(srcPos);
195 destBuffer.
putInt(destPos, word);
197 node.tag = (word >> 16) & 0xffff;
198 uint32_t dt = (word >> 8) & 0xff;
200 node.dataType = dt & 0x3f;
202 node.num = word & 0xff;
204 node.pos = destPos - 4;
205 node.dataPos = destPos + 4;
206 node.dataLen = length - 1;
228 std::shared_ptr<ByteBuffer> & srcBuffer,
229 std::shared_ptr<ByteBuffer> & destBuffer,
230 uint32_t srcPos, uint32_t destPos) {
231 swapSegmentHeader(*(node.get()), *(srcBuffer.get()), *(destBuffer.get()), srcPos, destPos);
253 uint32_t srcPos, uint32_t destPos) {
255 if (srcBuffer.
order() == destBuffer.
order()) {
260 uint32_t word = srcBuffer.
getInt(srcPos);
261 destBuffer.
putInt(destPos, word);
263 node.tag = (word >> 24) & 0xff;
264 uint32_t dt = (word >> 16) & 0xff;
265 node.dataType = dt & 0x3f;
267 node.len = word & 0xffff;
270 node.dataPos = destPos + 4;
271 node.dataLen = node.len;
292 std::shared_ptr<ByteBuffer> & srcBuffer,
293 std::shared_ptr<ByteBuffer> & destBuffer,
294 uint32_t srcPos, uint32_t destPos) {
316 uint32_t srcPos, uint32_t destPos) {
318 if (srcBuffer.
order() == destBuffer.
order()) {
323 uint32_t word = srcBuffer.
getInt(srcPos);
324 destBuffer.
putInt(destPos, word);
326 node.tag = (word >> 20) & 0xfff;
327 node.dataType = (word >> 16) & 0xf;
328 node.len = word & 0xffff;
332 node.dataPos = destPos + 4;
333 node.dataLen = node.len;
342 #endif //EVIO_6_0_EVENTHEADERPARSER_H
This class is copied from one of the same name in the Java programming language.
Definition: ByteBuffer.h:42
const ByteOrder & order() const
Get the byte order of the data.
Definition: ByteBuffer.cpp:466
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
This class is used to store relevant info about an evio container (bank, segment, or tag segment)...
Definition: EvioNode.h:41
int32_t getInt() const
Relative get method for reading an int value.
Definition: ByteBuffer.cpp:1074
static void toIntArray(char const *data, uint32_t dataLen, const ByteOrder &byteOrder, uint32_t *dest)
Turn byte array into an int array.
Definition: Util.h:133