DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
CreateSource.hpp
Go to the documentation of this file.
1
8#ifndef ASIOLIBS_SRC_CREATESOURCE_HPP_
9#define ASIOLIBS_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::TDEFrameTypeAdapter, "TDEFrame")
27DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::CRTBernTypeAdapter, "CRTBernFrame")
28DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::CRTGrenobleTypeAdapter, "CRTGrenobleFrame")
29
30namespace asiolibs {
31
32std::shared_ptr<SourceConcept>
33createSourceModel(const appmodel::DataMoveCallbackConf* conf)
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 // Get parser and sink
47 //auto& parser = source_model->get_parser();
48 //auto& sink = source_model->get_sink();
49 //auto& error_sink = source_model->get_error_sink();
50
51 // Modify parser as needed...
52 //parser.process_chunk_func = parsers::fixsizedChunkInto<fdreadoutlibs::types::ProtoWIBSuperChunkTypeAdapter>(sink);
53 //if (error_sink != nullptr) {
54 // parser.process_chunk_with_error_func = parsers::errorChunkIntoSink(error_sink);
55 //}
56 // parser.process_block_func = ...
57
58 // Return with setup model
59 return source_model;
60
61 } else if (datatype.find("TDEFrame") != std::string::npos) {
62 // WIB2 specific char arrays
63 auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::TDEFrameTypeAdapter>>();
64 source_model->set_sink_config(conf);
65 //auto& parser = source_model->get_parser();
66 //parser.process_chunk_func = parsers::fixsizedChunkInto<fdreadoutlibs::types::DUNEWIBSuperChunkTypeAdapter>(sink);
67 return source_model;
68 } else if (datatype.find("CRTBernFrame") != std::string::npos) {
69 auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::CRTBernTypeAdapter>>();
70 source_model->set_sink_config(conf);
71 return source_model;
72 } else if (datatype.find("CRTGrenobleFrame") != std::string::npos) {
73 auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::CRTGrenobleTypeAdapter>>();
74 source_model->set_sink_config(conf);
75 return source_model;
76 }
77
78 return nullptr;
79}
80
81} // namespace asiolibs
82} // namespace dunedaq
83
84#endif // ASIOLIBS_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.