Belle II Software
release-08-01-10
|
Helper class for getting data words from a finesse buffer Keeps checksum counter for each extracted data word and calculates tcp checksum on request. More...
#include <TOPUnpackerModule.h>
Public Member Functions | |
DataArray (const int *data, int size, bool swap=false) | |
Constructor. More... | |
int | getWord () |
Returns consecutive data word Updates internal checksum counter for each extracted word. More... | |
int | peekWord () |
Returns next data word without incrementing the memory pointer and without modifying the checksum counter. More... | |
int | getLastWord () |
Returns last data word. More... | |
unsigned int | getIndex () const |
Returns index of last returned data word. More... | |
int | getRemainingWords () const |
Returns number of remaining words in the buffer. More... | |
void | resetChecksum () |
Resets internal checksum counter. More... | |
unsigned int | foldChecksum () |
Performs folding of carry bits into checksum until only 16 LSBs are populated. More... | |
bool | validateChecksum () |
Validates current checksum counter status. More... | |
Private Member Functions | |
int | swap32 (int x) |
Swap bytes of a 32-bit integer. | |
Private Attributes | |
int | m_size = 0 |
buffer size | |
const int * | m_data = 0 |
buffer data | |
int | m_i = 0 |
index | |
bool | m_swap = false |
if true, swap bytes | |
unsigned int | m_checksumCounter |
check sum counter | |
Helper class for getting data words from a finesse buffer Keeps checksum counter for each extracted data word and calculates tcp checksum on request.
Definition at line 38 of file TOPUnpackerModule.h.
|
inline |
Constructor.
data | pointer to finesse buffer (pointer must be valid) |
size | buffer size |
swap | if set to true, swap bytes |
Definition at line 48 of file TOPUnpackerModule.h.
|
inline |
Performs folding of carry bits into checksum until only 16 LSBs are populated.
Definition at line 122 of file TOPUnpackerModule.h.
|
inline |
Returns index of last returned data word.
Definition at line 104 of file TOPUnpackerModule.h.
|
inline |
|
inline |
Returns number of remaining words in the buffer.
Definition at line 110 of file TOPUnpackerModule.h.
|
inline |
Returns consecutive data word Updates internal checksum counter for each extracted word.
Verify checksum using DataArray::validateChecksum()
Definition at line 63 of file TOPUnpackerModule.h.
|
inline |
Returns next data word without incrementing the memory pointer and without modifying the checksum counter.
Definition at line 79 of file TOPUnpackerModule.h.
|
inline |
Resets internal checksum counter.
Call at the beginning of each new block that is checksummed.
Definition at line 116 of file TOPUnpackerModule.h.
|
inline |
Validates current checksum counter status.
Call at the end of each block that is checksummed.
Definition at line 136 of file TOPUnpackerModule.h.