Line data Source code
1 : /**
2 : * @file DefaultParserImpl.cpp FELIX's packetformat default block/chunk parser
3 : * implementation.
4 : *
5 : * This is part of the DUNE DAQ , copyright 2020.
6 : * Licensing/copyright details are in the COPYING file that you should have
7 : * received with this code.
8 : */
9 : // From Module
10 : #include "DefaultParserImpl.hpp"
11 :
12 : // From STD
13 : #include <chrono>
14 : #include <iomanip>
15 :
16 : using namespace std::chrono_literals;
17 :
18 : namespace dunedaq {
19 : namespace flxlibs {
20 :
21 0 : DefaultParserImpl::DefaultParserImpl()
22 : {
23 0 : process_chunk_func = std::bind(&DefaultParserImpl::process_chunk, this, std::placeholders::_1);
24 0 : process_shortchunk_func = std::bind(&DefaultParserImpl::process_shortchunk, this, std::placeholders::_1);
25 0 : process_subchunk_func = std::bind(&DefaultParserImpl::process_subchunk, this, std::placeholders::_1);
26 0 : process_block_func = std::bind(&DefaultParserImpl::process_block, this, std::placeholders::_1);
27 0 : process_chunk_with_error_func = std::bind(&DefaultParserImpl::process_chunk_with_error, this, std::placeholders::_1);
28 0 : process_shortchunk_with_error_func =
29 0 : std::bind(&DefaultParserImpl::process_shortchunk_with_error, this, std::placeholders::_1);
30 0 : process_subchunk_with_error_func =
31 0 : std::bind(&DefaultParserImpl::process_subchunk_with_error, this, std::placeholders::_1);
32 0 : process_block_with_error_func = std::bind(&DefaultParserImpl::process_block_with_error, this, std::placeholders::_1);
33 0 : }
34 :
35 0 : DefaultParserImpl::~DefaultParserImpl() {}
36 :
37 : stats::ParserStats&
38 0 : DefaultParserImpl::get_stats()
39 : {
40 0 : return std::ref(m_stats);
41 : }
42 :
43 : void
44 0 : DefaultParserImpl::chunk_processed(const felix::packetformat::chunk& chunk)
45 : {
46 0 : process_chunk_func(chunk);
47 0 : m_stats.chunk_ctr++;
48 0 : }
49 :
50 : void
51 0 : DefaultParserImpl::shortchunk_processed(const felix::packetformat::shortchunk& shortchunk)
52 : {
53 0 : process_shortchunk_func(shortchunk);
54 0 : m_stats.short_ctr++;
55 0 : }
56 :
57 : void
58 0 : DefaultParserImpl::subchunk_processed(const felix::packetformat::subchunk& subchunk)
59 : {
60 0 : process_subchunk_func(subchunk);
61 0 : m_stats.subchunk_ctr++;
62 0 : }
63 :
64 : void
65 0 : DefaultParserImpl::block_processed(const felix::packetformat::block& block)
66 : {
67 0 : process_block_func(block);
68 0 : m_stats.block_ctr++;
69 0 : }
70 :
71 : void
72 0 : DefaultParserImpl::chunk_processed_with_error(const felix::packetformat::chunk& chunk)
73 : {
74 0 : process_chunk_with_error_func(chunk);
75 0 : m_stats.error_chunk_ctr++;
76 0 : }
77 :
78 : void
79 0 : DefaultParserImpl::subchunk_processed_with_error(const felix::packetformat::subchunk& subchunk)
80 : {
81 0 : process_subchunk_with_error_func(subchunk);
82 0 : if (subchunk.crcerr_flag) { // NOLINT(runtime/output_format)
83 0 : m_stats.subchunk_crc_error_ctr++;
84 : }
85 0 : if (subchunk.trunc_flag) {
86 0 : m_stats.subchunk_trunc_error_ctr++;
87 : }
88 0 : if (subchunk.err_flag) {
89 0 : m_stats.subchunk_error_ctr++;
90 : }
91 0 : m_stats.error_subchunk_ctr++;
92 0 : }
93 :
94 : void
95 0 : DefaultParserImpl::shortchunk_process_with_error(const felix::packetformat::shortchunk& shortchunk)
96 : {
97 0 : process_shortchunk_with_error_func(shortchunk);
98 0 : m_stats.error_short_ctr++;
99 0 : }
100 :
101 : void
102 0 : DefaultParserImpl::block_processed_with_error(const felix::packetformat::block& block)
103 : {
104 0 : process_block_with_error_func(block);
105 0 : m_stats.error_block_ctr++;
106 0 : }
107 :
108 : } // namespace flxlibs
109 : } // namespace dunedaq
|