Event Packet structure.
More...
#include <EventPacket.h>
Event Packet structure.
Definition at line 17 of file EventPacket.h.
◆ EventPacket()
packing::rawdatafile::EventPacket::EventPacket |
( |
uint32_t |
id, |
|
|
const std::map< uint16_t, std::vector< uint32_t > > & |
unwrapped_subsys_data |
|
) |
| |
define event id for reading
Definition at line 9 of file EventPacket.cxx.
12 : id_{id}, event_length_in_words_{0} {
13 crc_ok_ = true;
14
15 utility::CRC crc;
16
17 for (auto const& [subsys_id, subsys_data] : unwrapped_subsys_data) {
18 subsys_data_.emplace_back(id_, subsys_id, subsys_data);
19 auto& subsys = subsys_data_.back();
20 crc << subsys;
21 event_length_in_words_ +=
22 subsys.header().size() + subsys.data().size() + subsys.tail().size();
23 }
24
25 crc_ = crc.get();
26}
References packing::utility::CRC::get().
◆ add()
add the event packet to the input crc
Definition at line 59 of file EventPacket.cxx.
59 {
61 c << h << subsys_data_ << t;
62 return c;
63}
std::vector< uint32_t > header() const
Get the header words.
std::vector< uint32_t > tail() const
Get the tail words.
References header(), and tail().
◆ data()
std::vector< SubsystemPacket > & packing::rawdatafile::EventPacket::data |
( |
| ) |
|
|
inline |
◆ header()
std::vector< uint32_t > packing::rawdatafile::EventPacket::header |
( |
| ) |
const |
Get the header words.
Definition at line 28 of file EventPacket.cxx.
28 {
29 uint32_t word = ((subsys_data_.size() & utility::mask<16>) << 16) +
30 ((event_length_in_words_ & utility::mask<15>) << 1) + crc_ok_;
31 return {id_, word};
32}
Referenced by add(), and write().
◆ id()
const uint32_t & packing::rawdatafile::EventPacket::id |
( |
| ) |
const |
|
inline |
◆ read()
read the event packet from the input reader
Definition at line 36 of file EventPacket.cxx.
36 {
37 r >> id_;
38
39 uint32_t word;
40 r >> word;
41
42 uint16_t num_subsys = (word >> 16) & utility::mask<16>;
43 event_length_in_words_ = (word >> 1) & utility::mask<15>;
44 crc_ok_ = word & utility::mask<1>;
45
46 r.read(subsys_data_, num_subsys);
47
48 r >> crc_;
49
50 return r;
51}
References packing::utility::Reader::read().
◆ tail()
std::vector< uint32_t > packing::rawdatafile::EventPacket::tail |
( |
| ) |
const |
◆ write()
write the event packet to the input writer
Definition at line 53 of file EventPacket.cxx.
53 {
55 w << h << subsys_data_ << t;
56 return w;
57}
References header(), and tail().
◆ crc_
uint32_t packing::rawdatafile::EventPacket::crc_ |
|
private |
◆ crc_ok_
bool packing::rawdatafile::EventPacket::crc_ok_ |
|
private |
◆ event_length_in_words_
uint16_t packing::rawdatafile::EventPacket::event_length_in_words_ |
|
private |
◆ id_
uint32_t packing::rawdatafile::EventPacket::id_ |
|
private |
◆ subsys_data_
std::vector<SubsystemPacket> packing::rawdatafile::EventPacket::subsys_data_ |
|
private |
The documentation for this class was generated from the following files: