9#include "rawdata/dataobjects/RawPXD.h"
10#include "framework/logging/Logger.h"
11#include <framework/utilities/HTML.h>
21 : m_nwords(0), m_buffer(NULL)
23 m_nwords = (length_in_Bytes + 3) / 4;
31 ((x << 8) & 0x00FF0000) |
32 ((x >> 8) & 0x0000FF00) |
37RawPXD::RawPXD(
const std::vector <unsigned int>& header,
const std::vector <std::vector <unsigned char>>& payload)
38 : m_nwords(0), m_buffer(NULL)
42 int nr_frames = header.size();
44 for (
auto& it : header) {
45 payload_size += (it + 3) / 4;
48 m_nwords = 2 + nr_frames + payload_size;
52 B2DEBUG(20,
"RawPXD Frames " << header.size() <<
" Data " << payload_size <<
" (32 bitword)");
59 for (
auto& it : payload) {
63 unsigned char*
data = (
unsigned char*) &
m_buffer[offset];
64 for (
auto& it : payload) {
65 memcpy(
data, it.data(), it.size());
66 data += (it.size() + 3) & 0xFFFFFFFC;
93 s +=
"Size (32bit words): " + std::to_string(
m_nwords) +
"<br /><br />";
static unsigned int endian_swap(unsigned int x)
Endian swap a int32.
virtual int * data(void)
get pointer to data
int * m_buffer
Raw dump of ONSEN data. buffer of size m_nwords (32bit int)
int m_nwords
Number of (32bit) Words stored in the buffer.
virtual ~RawPXD()
Destructor.
RawPXD()
Default constructor.
std::string getInfoHTML() const
Return a short summary of this object's contents in HTML format.
virtual int size() const
get size of buffer in 32 Bit words
std::string getHexDump(const int *buf, int length)
Create hexdump of given buffer.
Abstract base class for different kinds of events.