DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
HSIEventToTCApplication.cpp
Go to the documentation of this file.
1
14#include "oks/kernel.hpp"
24#include "confmodel/Service.hpp"
26#include "logging/Logging.hpp"
27
28#include <string>
29#include <vector>
30
31namespace dunedaq {
32namespace appmodel {
33
34std::vector<const confmodel::DaqModule*>
36{
37
38 ConfigObjectFactory obj_fac(this);
39
40 std::vector<const confmodel::DaqModule*> modules;
41
42 std::string hstcUid("module-" + UID());
43 TLOG_DEBUG(7) << "creating OKS configuration object for the DataSubscriberModule class ";
44 conffwk::ConfigObject hstcObj = obj_fac.create("DataSubscriberModule", hstcUid);
45
46 auto hstcConf = get_hsevent_to_tc_conf();
47 hstcObj.set_obj("configuration", &hstcConf->config_object());
48
49 if (hstcConf == 0) {
50 throw(BadConf(ERS_HERE, "No HSI2TCTranslatorConf configuration given"));
51 }
52
55
56 for (auto rule : get_network_rules()) {
57 auto endpoint_class = rule->get_endpoint_class();
58 auto descriptor = rule->get_descriptor();
59
60 if (descriptor->get_data_type() == "HSIEvent") {
61 inObj = obj_fac.create_net_obj(descriptor, "");
62 }
63 else if (descriptor->get_data_type() == "TriggerCandidate") {
64 outObj = obj_fac.create_net_obj(descriptor, UID());
65 }
66 }
67
68 if (inObj == nullptr) {
69 throw(BadConf(ERS_HERE, "No HSIEvent input connection descriptor given"));
70 }
71 if (outObj == nullptr) {
72 throw(BadConf(ERS_HERE, "No TriggerCandidate output connection descriptor given"));
73 }
74
75 hstcObj.set_objs("inputs", {&inObj});
76 hstcObj.set_objs("outputs", {&outObj});
77
78 // Add to our list of modules to return
79 modules.push_back(obj_fac.get_dal<DataSubscriberModule>(hstcUid));
80
81 return modules;
82}
83
84} // namespace appmodel
85} // namespace dunedaq
#define ERS_HERE
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
std::vector< const dunedaq::confmodel::DaqModule * > generate_modules(const confmodel::Session *) 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:112
Including Qt Headers.