DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
CreateSource.hpp
Go to the documentation of this file.
1
8#ifndef DPDKLIBS_SRC_CREATESOURCE_HPP_
9#define DPDKLIBS_SRC_CREATESOURCE_HPP_
10
11#include "SourceConcept.hpp"
12#include "SourceModel.hpp"
14
19
20#include <memory>
21#include <string>
22
23namespace dunedaq {
24
26DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::TDEEthTypeAdapter, "TDEEthFrame")
27DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::DAPHNEEthTypeAdapter, "DAPHNEEthFrame")
28
29namespace dpdklibs {
30
31std::shared_ptr<SourceConcept>
32createSourceModel(const appmodel::DataMoveCallbackConf* conf)
33{
34
35 auto datatype = conf->get_data_type();
36 TLOG() << "Choosing specializations for SourceModel for output connection "
37 << " [uid:" << conf->UID() << " , data_type:" << datatype << ']';
38
39 if (datatype.find("WIBEthFrame") != std::string::npos) {
40 // Create Model
41 auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::DUNEWIBEthTypeAdapter>>();
42
43 // For callback acquisition later (lazy)
44 source_model->set_sink_config(conf);
45
46 // Return with setup model
47 return source_model;
48
49 } else if (datatype.find("TDEEthFrame") != std::string::npos) {
50
51 // Create Model
52 auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::TDEEthTypeAdapter>>();
53
54 // Disable DAQ protocol checks
55 source_model->disable_daq_protocol_checks();
56
57 // For callback acquisition later (lazy)
58 source_model->set_sink_config(conf);
59
60 return source_model;
61
62 } else if (datatype.find("DAPHNEEthFrame") != std::string::npos) {
63 // WIB2 specific char arrays
64 auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::DAPHNEEthTypeAdapter>>();
65
66 // For callback acquisition later (lazy)
67 source_model->set_sink_config(conf);
68
69 return source_model;
70 } else if (datatype.find("DAPHNEEthStreamFrame") != std::string::npos) {
71 // WIB2 specific char arrays
72 auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter>>();
73
74 // For callback acquisition later (lazy)
75 source_model->set_sink_config(conf);
76
77 return source_model;
78 }
79
80 return nullptr;
81}
82
83} // namespace dpdklibs
84} // namespace dunedaq
85
86#endif // DPDKLIBS_SRC_CREATESOURCE_HPP_
#define DUNE_DAQ_TYPESTRING(Type, typestring)
Declare the datatype_to_string method for the given type.
const std::string & get_data_type() const
Get "data_type" attribute value. Name of the output data type. Should be defined via a call to DUNE_D...
const std::string & UID() const noexcept
#define TLOG(...)
Definition macro.hpp:22
Including Qt Headers.