Line data Source code
1 : /**
2 : * @file CreateSource.hpp Specific SourceConcept creator.
3 : *
4 : * This is part of the DUNE DAQ , copyright 2020.
5 : * Licensing/copyright details are in the COPYING file that you should have
6 : * received with this code.
7 : */
8 : #ifndef DPDKLIBS_SRC_CREATESOURCE_HPP_
9 : #define DPDKLIBS_SRC_CREATESOURCE_HPP_
10 :
11 : #include "SourceConcept.hpp"
12 : #include "SourceModel.hpp"
13 : #include "datahandlinglibs/DataHandlingIssues.hpp"
14 :
15 : #include "fdreadoutlibs/DUNEWIBEthTypeAdapter.hpp"
16 : #include "fdreadoutlibs/TDEEthTypeAdapter.hpp"
17 : #include "fdreadoutlibs/DAPHNEEthTypeAdapter.hpp"
18 : #include "fdreadoutlibs/DAPHNEEthStreamTypeAdapter.hpp"
19 :
20 : #include <memory>
21 : #include <string>
22 :
23 : namespace dunedaq {
24 :
25 : DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::DUNEWIBEthTypeAdapter, "WIBEthFrame")
26 : DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::TDEEthTypeAdapter, "TDEEthFrame")
27 : DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::DAPHNEEthTypeAdapter, "DAPHNEEthFrame")
28 :
29 : namespace dpdklibs {
30 :
31 : std::shared_ptr<SourceConcept>
32 0 : createSourceModel(const appmodel::DataMoveCallbackConf* conf)
33 : {
34 :
35 0 : auto datatype = conf->get_data_type();
36 0 : TLOG() << "Choosing specializations for SourceModel for output connection "
37 0 : << " [uid:" << conf->UID() << " , data_type:" << datatype << ']';
38 :
39 0 : if (datatype.find("WIBEthFrame") != std::string::npos) {
40 : // Create Model
41 0 : auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::DUNEWIBEthTypeAdapter>>();
42 :
43 : // For callback acquisition later (lazy)
44 0 : source_model->set_sink_config(conf);
45 :
46 : // Return with setup model
47 0 : return source_model;
48 :
49 0 : } else if (datatype.find("TDEEthFrame") != std::string::npos) {
50 :
51 : // Create Model
52 0 : auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::TDEEthTypeAdapter>>();
53 :
54 : // Disable DAQ protocol checks
55 0 : source_model->disable_daq_protocol_checks();
56 :
57 : // For callback acquisition later (lazy)
58 0 : source_model->set_sink_config(conf);
59 :
60 0 : return source_model;
61 :
62 0 : } else if (datatype.find("DAPHNEEthFrame") != std::string::npos) {
63 : // WIB2 specific char arrays
64 0 : auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::DAPHNEEthTypeAdapter>>();
65 :
66 : // For callback acquisition later (lazy)
67 0 : source_model->set_sink_config(conf);
68 :
69 0 : return source_model;
70 0 : } else if (datatype.find("DAPHNEEthStreamFrame") != std::string::npos) {
71 : // WIB2 specific char arrays
72 0 : auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter>>();
73 :
74 : // For callback acquisition later (lazy)
75 0 : source_model->set_sink_config(conf);
76 :
77 0 : return source_model;
78 0 : }
79 :
80 0 : return nullptr;
81 0 : }
82 :
83 : } // namespace dpdklibs
84 : } // namespace dunedaq
85 :
86 : #endif // DPDKLIBS_SRC_CREATESOURCE_HPP_
|