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 CRTMODULES_SRC_CREATESOURCE_HPP_
9 : #define CRTMODULES_SRC_CREATESOURCE_HPP_
10 :
11 : #include "SourceConcept.hpp"
12 : #include "SourceModel.hpp"
13 : #include "datahandlinglibs/DataHandlingIssues.hpp"
14 :
15 : #include "fdreadoutlibs/CRTBernTypeAdapter.hpp"
16 : #include "fdreadoutlibs/CRTGrenobleTypeAdapter.hpp"
17 :
18 : #include <memory>
19 : #include <string>
20 :
21 : namespace dunedaq {
22 :
23 : DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::CRTBernTypeAdapter, "CRTBernFrame")
24 : DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::CRTGrenobleTypeAdapter, "CRTGrenobleFrame")
25 :
26 : namespace crtmodules {
27 :
28 : std::shared_ptr<SourceConcept>
29 0 : createSourceModel(const appmodel::DataMoveCallbackConf* conf)
30 : {
31 0 : auto datatype = conf->get_data_type();
32 0 : TLOG() << "Choosing specializations for SourceModel for output connection "
33 0 : << " [uid:" << conf->UID() << " , data_type:" << datatype << ']';
34 :
35 0 : if (datatype.find("CRTBernFrame") != std::string::npos) {
36 0 : auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::CRTBernTypeAdapter>>();
37 0 : source_model->set_sink_config(conf);
38 0 : return source_model;
39 0 : } else if (datatype.find("CRTGrenobleFrame") != std::string::npos) {
40 0 : auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::CRTGrenobleTypeAdapter>>();
41 0 : source_model->set_sink_config(conf);
42 0 : return source_model;
43 0 : }
44 :
45 0 : return nullptr;
46 0 : }
47 :
48 : } // namespace crtmodules
49 : } // namespace dunedaq
50 :
51 : #endif // CRTMODULES_SRC_CREATESOURCE_HPP_
|