DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
CreateSource.hpp
Go to the documentation of this file.
1
8#ifndef CRTMODULES_SRC_CREATESOURCE_HPP_
9#define CRTMODULES_SRC_CREATESOURCE_HPP_
10
11#include "SourceConcept.hpp"
12#include "SourceModel.hpp"
14
17
18#include <memory>
19#include <string>
20
21namespace dunedaq {
22
24DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::CRTGrenobleTypeAdapter, "CRTGrenobleFrame")
25
26namespace crtmodules {
27
28std::shared_ptr<SourceConcept>
29createSourceModel(const std::string& conn_uid, bool callback_mode)
30{
31 auto datatypes = dunedaq::iomanager::IOManager::get()->get_datatypes(conn_uid);
32 if (datatypes.size() != 1) {
33 ers::error(dunedaq::datahandlinglibs::GenericConfigurationError(ERS_HERE,
34 "Multiple output data types specified! Expected only a single type!"));
35 }
36 std::string raw_dt{ *datatypes.begin() };
37 TLOG() << "Choosing specializations for SourceModel for output connection "
38 << " [uid:" << conn_uid << " , data_type:" << raw_dt << ']';
39
40 if (raw_dt.find("CRTBernFrame") != std::string::npos) {
41 auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::CRTBernTypeAdapter>>();
42 source_model->set_sink_name(conn_uid);
43 source_model->set_sink(conn_uid, callback_mode);
44 return source_model;
45 } else if (raw_dt.find("CRTGrenobleFrame") != std::string::npos) {
46 auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::CRTGrenobleTypeAdapter>>();
47 source_model->set_sink_name(conn_uid);
48 source_model->set_sink(conn_uid, callback_mode);
49 return source_model;
50 }
51
52 return nullptr;
53}
54
55} // namespace crtmodules
56} // namespace dunedaq
57
58#endif // CRTMODULES_SRC_CREATESOURCE_HPP_
#define ERS_HERE
#define DUNE_DAQ_TYPESTRING(Type, typestring)
static std::shared_ptr< IOManager > get()
Definition IOManager.hpp:40
#define TLOG(...)
Definition macro.hpp:22
Including Qt Headers.
void error(const Issue &issue)
Definition ers.hpp:81