DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
SNBBookkeeperApplication.cpp
Go to the documentation of this file.
1
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
35{
36 ConfigObjectFactory obj_fac(this);
37
38 std::vector<const confmodel::DaqModule*> modules;
39
40 std::string snbBookkeeperUid("snb-sample-config-" + UID());
41 TLOG_DEBUG(7) << "creating OKS configuration object for SNBBookkeeperModule class ";
42 auto snbBookkeeperObj = obj_fac.create("SNBTransferBookkeeper", snbBookkeeperUid);
43
44 auto snbBookkeeperConf = get_snbbk();
45 snbBookkeeperObj.set_obj("configuration", &snbBookkeeperConf->config_object());
46
47 if (snbBookkeeperConf == 0) {
48 throw(BadConf(ERS_HERE, "No SNBBookkeeperConf configuration given"));
49 }
50
51 std::vector<const conffwk::ConfigObject*> input_conns;
52 conffwk::ConfigObject notificationInObj;
53
54 for (auto rule : get_network_rules()) {
55 auto endpoint_class = rule->get_endpoint_class();
56 auto descriptor = rule->get_descriptor();
57
58 auto connObj = obj_fac.create_net_obj(descriptor, "");
59
60 if (descriptor->get_data_type() == "notification_t") {
61 notificationInObj = connObj;
62 input_conns.push_back(&notificationInObj);
63 }
64 }
65
66 if (notificationInObj == nullptr) {
67 throw(BadConf(ERS_HERE, "No Notification input connection descriptor given"));
68 }
69
70 snbBookkeeperObj.set_objs("inputs", input_conns);
71
72 // Add to our list of modules to return
73 modules.push_back(obj_fac.get_dal<SNBTransferBookkeeper>(snbBookkeeperUid));
74
75 obj_fac.update_modules(modules);
76}
77
78} // namespace appmodel
79} // 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
const dunedaq::appmodel::SNBBookkeeperConf * get_snbbk() const
Get "snbbk" relationship value.
void generate_modules(const confmodel::Session *) const override
const std::vector< const dunedaq::appmodel::NetworkConnectionRule * > & get_network_rules() const
Get "network_rules" relationship value.
const std::string & UID() const noexcept
conffwk entry point
#define TLOG_DEBUG(lvl,...)
Definition Logging.hpp:112
The DUNE-DAQ namespace.