DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
HSIEventToTCApplication.cpp
Go to the documentation of this file.
1
10
23#include "confmodel/Service.hpp"
24#include "logging/Logging.hpp"
25#include "oks/kernel.hpp"
26
27#include <string>
28#include <vector>
29
30namespace dunedaq {
31namespace appmodel {
32
33void
34HSIEventToTCApplication::generate_modules(std::shared_ptr<appmodel::ConfigurationHelper> /*helper*/) const
35{
36
37 ConfigObjectFactory obj_fac(this);
38
39 std::vector<const confmodel::DaqModule*> modules;
40
41 std::string hstcUid("module-" + UID());
42 TLOG_DEBUG(7) << "creating OKS configuration object for the DataSubscriberModule class ";
43 conffwk::ConfigObject hstcObj = obj_fac.create("DataSubscriberModule", hstcUid);
44
45 auto hstcConf = get_hsevent_to_tc_conf();
46 hstcObj.set_obj("configuration", &hstcConf->config_object());
47
48 if (hstcConf == 0) {
49 throw(BadConf(ERS_HERE, "No HSI2TCTranslatorConf configuration given"));
50 }
51
54
55 for (auto rule : get_network_rules()) {
56 auto endpoint_class = rule->get_endpoint_class();
57 auto descriptor = rule->get_descriptor();
58
59 if (descriptor->get_data_type() == "HSIEvent") {
60 inObj = obj_fac.create_net_obj(descriptor, "");
61 } else if (descriptor->get_data_type() == "TriggerCandidate") {
62 outObj = obj_fac.create_net_obj(descriptor, UID());
63 }
64 }
65
66 if (inObj == nullptr) {
67 throw(BadConf(ERS_HERE, "No HSIEvent input connection descriptor given"));
68 }
69 if (outObj == nullptr) {
70 throw(BadConf(ERS_HERE, "No TriggerCandidate output connection descriptor given"));
71 }
72
73 hstcObj.set_objs("inputs", { &inObj });
74 hstcObj.set_objs("outputs", { &outObj });
75
76 // Add to our list of modules to return
77 modules.push_back(obj_fac.get_dal<DataSubscriberModule>(hstcUid));
78
79 obj_fac.update_modules(modules);
80}
81
82} // namespace appmodel
83} // namespace dunedaq
#define ERS_HERE
void update_modules(const std::vector< const confmodel::DaqModule * > &modules)
conffwk::ConfigObject create_net_obj(const NetworkConnectionDescriptor *ndesc, std::string uid) const
Helper function that gets a network connection config.
const T * get_dal(std::string uid) const
conffwk::ConfigObject create(const std::string &class_name, const std::string &id) const
void generate_modules(std::shared_ptr< appmodel::ConfigurationHelper >) const override
const dunedaq::appmodel::HSI2TCTranslatorConf * get_hsevent_to_tc_conf() const
Get "hsevent_to_tc_conf" relationship value.
const std::vector< const dunedaq::appmodel::NetworkConnectionRule * > & get_network_rules() const
Get "network_rules" relationship value.
void set_objs(const std::string &name, const std::vector< const ConfigObject * > &o, bool skip_non_null_check=false)
Set relationship multi-value.
void set_obj(const std::string &name, const ConfigObject *o, bool skip_non_null_check=false)
Set relationship single-value.
const std::string & UID() const noexcept
conffwk entry point
#define TLOG_DEBUG(lvl,...)
Definition Logging.hpp:116
The DUNE-DAQ namespace.
CIB Buffer std::string descriptor Message from std::string descriptor CIB process std::string descriptor descriptor