Line data Source code
1 : /**
2 : * @file SourceConcept.hpp SourceConcept for constructors and
3 : * forwarding command args. Enforces the implementation to
4 : * queue in UDP JUMBO frames to be translated to TypeAdapters and
5 : * send them to corresponding sinks.
6 : *
7 : * This is part of the DUNE DAQ , copyright 2020.
8 : * Licensing/copyright details are in the COPYING file that you should have
9 : * received with this code.
10 : */
11 : #ifndef DPDKLIBS_SRC_SOURCECONCEPT_HPP_
12 : #define DPDKLIBS_SRC_SOURCECONCEPT_HPP_
13 :
14 : //#include "DefaultParserImpl.hpp"
15 :
16 : #include "opmonlib/MonitorableObject.hpp"
17 : #include "appfwk/DAQModule.hpp"
18 : //#include "packetformat/detail/block_parser.hpp"
19 : #include <nlohmann/json.hpp>
20 :
21 : #include <memory>
22 : #include <sstream>
23 : #include <string>
24 :
25 : namespace dunedaq {
26 : namespace dpdklibs {
27 :
28 : class SourceConcept : public opmonlib::MonitorableObject
29 : {
30 : public:
31 0 : SourceConcept() {}
32 0 : virtual ~SourceConcept() {}
33 :
34 : SourceConcept(const SourceConcept&) = delete; ///< SourceConcept is not copy-constructible
35 : SourceConcept& operator=(const SourceConcept&) = delete; ///< SourceConcept is not copy-assginable
36 : SourceConcept(SourceConcept&&) = delete; ///< SourceConcept is not move-constructible
37 : SourceConcept& operator=(SourceConcept&&) = delete; ///< SourceConcept is not move-assignable
38 :
39 : // virtual void init(const nlohmann::json& args) = 0;
40 : virtual void set_sink(const std::string& sink_name, bool callback_mode) = 0;
41 : virtual void acquire_callback() = 0;
42 : // virtual void conf(const nlohmann::json& args) = 0;
43 : // virtual void start(const nlohmann::json& args) = 0;
44 : // virtual void stop(const nlohmann::json& args) = 0;
45 :
46 : // Meant to process an incoming raw byte buffer and extract complete frames of arbitrary types in specialized models.
47 : virtual void handle_daq_frame(char* buffer, std::size_t size) = 0;
48 :
49 0 : void set_sink_name(const std::string& sink_name)
50 : {
51 0 : m_sink_name = sink_name;
52 0 : }
53 :
54 : // Disables DAQEth protocol on this source
55 0 : void disable_daq_protocol_checks() {
56 0 : m_daq_protocol_ensured = false;
57 0 : }
58 :
59 : // Sink or destination related
60 : std::string m_sink_name;
61 :
62 : // Features
63 : bool m_daq_protocol_ensured { true };
64 :
65 : };
66 :
67 : } // namespace dpdklibs
68 : } // namespace dunedaq
69 :
70 : #endif // DPDKLIBS_SRC_SOURCECONCEPT_HPP_
|