8#include "daq/slc/base/Reader.h"
10#include "daq/slc/base/Serializable.h"
18void Reader::reverse(
void* buf,
size_t len)
20 for (
int c = 0 ; c < (int)len / 2 ; c ++) {
21 char tmp = *((
char*)buf + c);
22 *((
char*)buf + c) = *((
char*)buf + len - 1 - c);
23 *((
char*)buf + len - 1 - c) = tmp;
27bool Reader::readBool()
30 read(&v,
sizeof(
bool));
34char Reader::readChar()
37 read(&v,
sizeof(
char));
41unsigned char Reader::readUChar()
44 read(&v,
sizeof(
unsigned char));
48short Reader::readShort()
51 read(&v,
sizeof(
short));
52#if defined(__ENDIAN_L__)
53 reverse(&v,
sizeof(
short));
58unsigned short Reader::readUShort()
61 read(&v,
sizeof(
unsigned short));
62#if defined(__ENDIAN_L__)
63 reverse(&v,
sizeof(
unsigned short));
71 read(&v,
sizeof(
int));
72#if defined(__ENDIAN_L__)
73 reverse(&v,
sizeof(
int));
78unsigned int Reader::readUInt()
81 read(&v,
sizeof(
unsigned int));
82#if defined(__ENDIAN_L__)
83 reverse(&v,
sizeof(
unsigned int));
88long long Reader::readLong()
91 read(&v,
sizeof(
long long));
92#if defined(__ENDIAN_L__)
93 reverse(&v,
sizeof(
long long));
98unsigned long long Reader::readULong()
100 unsigned long long v;
101 read(&v,
sizeof(
unsigned long long));
102#if defined(__ENDIAN_L__)
103 reverse(&v,
sizeof(
unsigned long long));
108float Reader::readFloat()
111 read(&v,
sizeof(
float));
112#if defined(__ENDIAN_L__)
113 reverse(&v,
sizeof(
float));
118double Reader::readDouble()
121 read(&v,
sizeof(
double));
122#if defined(__ENDIAN_L__)
123 reverse(&v,
sizeof(
double));
128const std::string Reader::readString()
130 int count = readInt();
134 int c = (count > 1024) ? 1024 : count;
Abstract base class for different kinds of events.