Line data Source code
1 : /**
2 : * @file ElinkConcept.hpp ElinkConcept for constructors and
3 : * forwarding command args. Enforces the implementation to
4 : * queue in block_addresses
5 : *
6 : * This is part of the DUNE DAQ , copyright 2020.
7 : * Licensing/copyright details are in the COPYING file that you should have
8 : * received with this code.
9 : */
10 : #ifndef FLXLIBS_SRC_ELINKCONCEPT_HPP_
11 : #define FLXLIBS_SRC_ELINKCONCEPT_HPP_
12 :
13 : #include "DefaultParserImpl.hpp"
14 :
15 : #include "appfwk/DAQModule.hpp"
16 : #include "packetformat/detail/block_parser.hpp"
17 :
18 : #include "appmodel/DataMoveCallbackConf.hpp"
19 :
20 : #include <memory>
21 : #include <sstream>
22 : #include <string>
23 :
24 : namespace dunedaq {
25 : namespace flxlibs {
26 :
27 : class ElinkConcept : public opmonlib::MonitorableObject
28 : {
29 : public:
30 0 : ElinkConcept()
31 0 : : m_parser_impl()
32 0 : , m_card_id(0)
33 0 : , m_logical_unit(0)
34 0 : , m_link_id(0)
35 0 : , m_link_tag(0)
36 0 : , m_elink_str("")
37 0 : , m_elink_source_tid("")
38 : {
39 0 : m_parser = std::make_unique<felix::packetformat::BlockParser<DefaultParserImpl>>(m_parser_impl);
40 0 : }
41 0 : virtual ~ElinkConcept() {}
42 :
43 : ElinkConcept(const ElinkConcept&) = delete; ///< ElinkConcept is not copy-constructible
44 : ElinkConcept& operator=(const ElinkConcept&) = delete; ///< ElinkConcept is not copy-assginable
45 : ElinkConcept(ElinkConcept&&) = delete; ///< ElinkConcept is not move-constructible
46 : ElinkConcept& operator=(ElinkConcept&&) = delete; ///< ElinkConcept is not move-assignable
47 :
48 : virtual void init(const size_t block_queue_capacity) = 0;
49 : virtual void acquire_callback() = 0;
50 :
51 : virtual void conf(size_t block_size, bool is_32b_trailers) = 0;
52 : virtual void start() = 0;
53 : virtual void stop() = 0;
54 :
55 : virtual bool queue_in_block_address(uint64_t block_addr) = 0; // NOLINT
56 :
57 0 : DefaultParserImpl& get_parser() { return std::ref(m_parser_impl); }
58 :
59 0 : void set_sink_config(const appmodel::DataMoveCallbackConf* sink_conf) { m_sink_conf = sink_conf; }
60 :
61 0 : void set_ids(int card, int slr, int id, int tag)
62 : {
63 0 : m_card_id = card;
64 0 : m_logical_unit = slr;
65 0 : m_link_id = id;
66 0 : m_link_tag = tag;
67 :
68 0 : std::ostringstream lidstrs;
69 0 : lidstrs << "Elink["
70 0 : << "cid:" << std::to_string(m_card_id) << "|"
71 0 : << "slr:" << std::to_string(m_logical_unit) << "|"
72 0 : << "lid:" << std::to_string(m_link_id) << "|"
73 0 : << "tag:" << std::to_string(m_link_tag) << "]";
74 0 : m_elink_str = lidstrs.str();
75 :
76 0 : std::ostringstream tidstrs;
77 0 : tidstrs << "ept-" << std::to_string(m_card_id) << "-" << std::to_string(m_logical_unit);
78 0 : m_elink_source_tid = tidstrs.str();
79 0 : }
80 :
81 : const appmodel::DataMoveCallbackConf* m_sink_conf;
82 :
83 : protected:
84 : // Block Parser
85 : DefaultParserImpl m_parser_impl;
86 : std::unique_ptr<felix::packetformat::BlockParser<DefaultParserImpl>> m_parser;
87 :
88 : int m_card_id;
89 : int m_logical_unit;
90 : int m_link_id;
91 : int m_link_tag;
92 : std::string m_elink_str;
93 : std::string m_elink_source_tid;
94 : std::chrono::time_point<std::chrono::high_resolution_clock> m_t0;
95 :
96 : private:
97 : };
98 :
99 : } // namespace flxlibs
100 : } // namespace dunedaq
101 :
102 : #endif // FLXLIBS_SRC_ELINKCONCEPT_HPP_
|