48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include "fragment_dataformat.h"
|
|
#include <cstdint>
|
|
#include <cstdio>
|
|
|
|
#define FULL_EVENT_HEADER_MARKER 0xaa1234aa
|
|
|
|
typedef struct FullEvent {
|
|
uint32_t startOfHeaderMarker = FULL_EVENT_HEADER_MARKER;
|
|
uint32_t headerSize;
|
|
uint32_t eventSize;
|
|
uint32_t runNumber;
|
|
uint32_t eventNumber;
|
|
|
|
Fragment *fragmentsArray;
|
|
|
|
public:
|
|
FullEvent() : fragmentsArray(NULL) {}
|
|
~FullEvent() {
|
|
if (fragmentsArray != NULL) {
|
|
delete [] fragmentsArray;
|
|
}
|
|
}
|
|
|
|
}FullEvent;
|
|
|
|
void printFullEvent(FullEvent &fullEvent) {
|
|
printf("0x%08x\n", fullEvent.startOfHeaderMarker);
|
|
printf("0x%08x\n", fullEvent.headerSize);
|
|
printf("0x%08x\n", fullEvent.eventSize);
|
|
printf("0x%08x\n", fullEvent.runNumber);
|
|
printf("0x%08x\n", fullEvent.eventNumber);
|
|
|
|
printf("\n");
|
|
|
|
|
|
uint32_t remainingPayloadSize = fullEvent.eventSize - fullEvent.headerSize;
|
|
uint32_t counter = 0;
|
|
while (remainingPayloadSize > 0) {
|
|
printFragment(fullEvent.fragmentsArray[counter]);
|
|
remainingPayloadSize -= fullEvent.fragmentsArray[counter].header.fragmentSize;
|
|
counter++;
|
|
printf("\n");
|
|
}
|
|
|
|
printf("\n\n\n");
|
|
} |