SubsystemPacket structure.
More...
#include <SubsystemPacket.h>
SubsystemPacket structure.
Definition at line 16 of file SubsystemPacket.h.
◆ SubsystemPacket()
packing::rawdatafile::SubsystemPacket::SubsystemPacket |
( |
uint32_t |
event, |
|
|
uint16_t |
id, |
|
|
std::vector< uint32_t > |
data |
|
) |
| |
constructor for writing
Definition at line 9 of file SubsystemPacket.cxx.
11 : event_{
event}, id_{
id}, data_{
data} {
12 crc_ok_ = true;
13
14 utility::CRC crc;
15 crc << data_;
16
17 crc_ = crc.get();
18}
std::vector< uint32_t > & data()
Get data.
References packing::utility::CRC::get().
◆ add()
add the subsystem packet to the input crc
Definition at line 51 of file SubsystemPacket.cxx.
51 {
52 std::vector<uint32_t> head{
header()}, t{
tail()};
53 c << head << data_ << t;
54 return c;
55}
std::vector< uint32_t > tail() const
get the tailing words
std::vector< uint32_t > header() const
get the header words
References header(), and tail().
◆ data()
std::vector< uint32_t > & packing::rawdatafile::SubsystemPacket::data |
( |
| ) |
|
|
inline |
◆ header()
std::vector< uint32_t > packing::rawdatafile::SubsystemPacket::header |
( |
| ) |
const |
get the header words
Definition at line 20 of file SubsystemPacket.cxx.
20 {
21 uint32_t word = ((id_ & utility::mask<16>) << 16) +
22 ((data_.size() & utility::mask<15>) << 1) + crc_ok_;
23 return {word, event_};
24}
Referenced by add(), and write().
◆ id()
const uint16_t & packing::rawdatafile::SubsystemPacket::id |
( |
| ) |
const |
|
inline |
◆ read()
read the subsystem packet from the input reader
Definition at line 28 of file SubsystemPacket.cxx.
28 {
29 uint32_t word;
30 r >> word;
31
32 id_ = (word >> 16) & utility::mask<16>;
33 uint32_t len = (word >> 1) & utility::mask<15>;
34 crc_ok_ = word & utility::mask<1>;
35
36 r >> event_;
37
38 r.read(data_, len);
39
40 r >> crc_;
41
42 return r;
43}
References packing::utility::Reader::read().
◆ tail()
std::vector< uint32_t > packing::rawdatafile::SubsystemPacket::tail |
( |
| ) |
const |
◆ write()
write the subsystem packet to the input writer
Definition at line 45 of file SubsystemPacket.cxx.
45 {
46 std::vector<uint32_t> head{
header()}, t{
tail()};
47 w << head << data_ << t;
48 return w;
49}
References header(), and tail().
◆ crc_
unsigned int packing::rawdatafile::SubsystemPacket::crc_ |
|
private |
◆ crc_ok_
bool packing::rawdatafile::SubsystemPacket::crc_ok_ |
|
private |
◆ data_
std::vector<uint32_t> packing::rawdatafile::SubsystemPacket::data_ |
|
private |
◆ event_
uint32_t packing::rawdatafile::SubsystemPacket::event_ |
|
private |
◆ id_
uint16_t packing::rawdatafile::SubsystemPacket::id_ |
|
private |
The documentation for this class was generated from the following files: