1 #include "otsdaq-core/DataDecoders/DataDecoder.h"
2 #include "otsdaq-core/MessageFacility/MessageFacility.h"
3 #include "otsdaq-core/Macros/CoutHeaderMacros.h"
14 DataDecoder::DataDecoder(
void)
18 DataDecoder::~DataDecoder(
void)
22 void DataDecoder::convertBuffer(
const std::string& buffer, std::queue<uint32_t>& convertedBuffer,
bool invert)
24 for(
unsigned int i=0; i<buffer.length(); i+=4 )
25 convertedBuffer.push(convertBuffer(buffer, i, invert));
29 uint32_t DataDecoder::convertBuffer(
const std::string& buffer,
unsigned int bufferIndex,
bool invert)
32 return (
unsigned int)(((
unsigned char)buffer[bufferIndex ]) << 24)
33 + (
unsigned int)(((
unsigned char)buffer[bufferIndex+1]) << 16)
34 + (
unsigned int)(((
unsigned char)buffer[bufferIndex+2]) << 8)
35 + (
unsigned int)( (
unsigned char)buffer[bufferIndex+3]);
37 return (
unsigned int)((
unsigned char)buffer[bufferIndex ])
38 + (
unsigned int)(((
unsigned char)buffer[bufferIndex+1]) << 8)
39 + (
unsigned int)(((
unsigned char)buffer[bufferIndex+2]) << 16)
40 + (
unsigned int)(((
unsigned char)buffer[bufferIndex+3]) << 24);
45 bool DataDecoder::isBCOHigh(uint32_t data)
47 return bcoDataDecoder_.isBCOHigh(data);
51 bool DataDecoder::isBCOLow(uint32_t data)
53 return bcoDataDecoder_.isBCOLow(data);
57 bool DataDecoder::isTriggerLow(uint32_t data)
59 return triggerDataDecoder_.isTriggerLow(data);
63 bool DataDecoder::isTriggerHigh(uint32_t data)
65 return triggerDataDecoder_.isTriggerHigh(data);
69 bool DataDecoder::isFSSRData(uint32_t data)
71 return FSSRDataDecoder_.isFSSR(data);
75 bool DataDecoder::isVIPICData(uint32_t data)
77 return VIPICDataDecoder_.isVIPIC(data);
81 bool DataDecoder::isPSI46Data(uint32_t data)
83 return PSI46DataDecoder_.isPSI46(data);
87 bool DataDecoder::isPSI46DigData(uint32_t data)
89 return PSI46DigDataDecoder_.isPSI46Dig(data);
93 uint64_t DataDecoder::mergeBCOHighAndLow(uint32_t dataBCOHigh, uint32_t dataBCOLow)
95 return bcoDataDecoder_.mergeBCOHighAndLow(bcoDataDecoder_.decodeBCOHigh(dataBCOHigh),bcoDataDecoder_.decodeBCOLow(dataBCOLow));
99 uint64_t DataDecoder::mergeTriggerHighAndLow(uint32_t dataTriggerHigh, uint32_t dataTriggerLow)
101 return triggerDataDecoder_.mergeTriggerHighAndLow(triggerDataDecoder_.decodeTriggerHigh(dataTriggerHigh),triggerDataDecoder_.decodeTriggerLow(dataTriggerLow));
105 void DataDecoder::insertBCOHigh(uint64_t& bco, uint32_t dataBCOHigh)
107 bcoDataDecoder_.insertBCOHigh(bco,dataBCOHigh);
111 void DataDecoder::insertBCOLow(uint64_t& bco, uint32_t dataBCOLow)
113 bcoDataDecoder_.insertBCOLow(bco,dataBCOLow);
121 FSSRDataDecoder_.decode(data);
124 else if(isVIPICData(data))
126 VIPICDataDecoder_.decode(data);
129 else if(isPSI46DigData(data))
131 PSI46DigDataDecoder_.decode(data);