DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
ConfigObjectFactory.cpp
Go to the documentation of this file.
1
3
4namespace dunedaq {
5namespace appmodel {
6
8 const std::string& dbfile,
9 const std::string& app_uid)
10 : m_config(config),
11 m_dbfile(dbfile),
12 m_app_uid(app_uid) {
13
14 //FIXME: remove this hacky hack
16}
17
18
19
21 m_config(&parent->configuration()),
22 m_dbfile(parent->config_object().contained_in()),
23 m_app_uid(parent->UID()) {
24
25 //FIXME: remove this hacky hack
27}
28
30 //FIXME: remove this hacky hack
32}
33
35ConfigObjectFactory::create(const std::string& class_name,
36 const std::string& id) const {
38 m_config->create(m_dbfile, class_name, id, cfg_obj);
39 return cfg_obj;
40}
41
42//---
44ConfigObjectFactory::create_queue_obj(const QueueDescriptor* qdesc, std::string uid) const {
45
46 std::string queue_uid(qdesc->get_uid_base() + uid);
47 auto queue_obj = create("Queue", queue_uid);
48 queue_obj.set_by_val<std::string>("data_type", qdesc->get_data_type());
49 queue_obj.set_by_val<std::string>("queue_type", qdesc->get_queue_type());
50 queue_obj.set_by_val<uint32_t>("capacity", qdesc->get_capacity());
51
52 return queue_obj;
53}
54
55//---
57ConfigObjectFactory::create_queue_sid_obj(const QueueDescriptor* qdesc, uint32_t src_id) const {
58 std::string queue_uid(fmt::format("{}{}", qdesc->get_uid_base(), src_id));
59 auto queue_obj = create("QueueWithSourceId", queue_uid);
60
61 queue_obj.set_by_val<std::string>("data_type", qdesc->get_data_type());
62 queue_obj.set_by_val<std::string>("queue_type", qdesc->get_queue_type());
63 queue_obj.set_by_val<uint32_t>("capacity", qdesc->get_capacity());
64 queue_obj.set_by_val<uint32_t>("source_id", src_id);
65
66 return queue_obj;
67}
68
69//---
75
76//---
77
88 std::string app_uid) const {
89
90 auto svc_obj = ndesc->get_associated_service()->config_object();
91 std::string net_id = ndesc->get_uid_base() + app_uid;
92 auto net_obj = create("NetworkConnection", net_id);
93
94 net_obj.set_by_val<std::string>("data_type", ndesc->get_data_type());
95 net_obj.set_by_val<std::string>("connection_type", ndesc->get_connection_type());
96 net_obj.set_obj("associated_service", &svc_obj);
97
98 return net_obj;
99}
100
105
106} // namespace appmodel
107} // namespace dunedaq
conffwk::ConfigObject create_queue_sid_obj(const QueueDescriptor *qdesc, uint32_t src_id) const
conffwk::ConfigObject create_net_obj(const NetworkConnectionDescriptor *ndesc, std::string uid) const
Helper function that gets a network connection config.
ConfigObjectFactory(conffwk::Configuration *config, const std::string &dbfile, const std::string &app_uid)
conffwk::ConfigObject create_queue_obj(const QueueDescriptor *qdesc, std::string uid="") const
conffwk::ConfigObject create(const std::string &class_name, const std::string &id) const
const std::string & get_connection_type() const
Get "connection_type" attribute value.
const std::string & get_data_type() const
Get "data_type" attribute value. string identifying type of data transferred through this connection.
const std::string & get_uid_base() const
Get "uid_base" attribute value. Base for UID string. To be combined with a source id.
const dunedaq::confmodel::Service * get_associated_service() const
Get "associated_service" relationship value. Service provided by this connection.
const std::string & get_queue_type() const
Get "queue_type" attribute value. Type of queue.
const std::string & get_data_type() const
Get "data_type" attribute value. string identifying type of data transferred through this queue.
uint32_t get_capacity() const
Get "capacity" attribute value.
const std::string & get_uid_base() const
Get "uid_base" attribute value. Base for UID string. May be combined with a source id.
void create(const std::string &at, const std::string &class_name, const std::string &id, ConfigObject &object)
Create new object by class name and object id.
The base class for any generated DAL object.
Definition DalObject.hpp:45
const ConfigObject & config_object() const
uint32_t get_source_id() const
Get "source_id" attribute value.
static void set_nolock_mode(bool nl)
Definition file.hpp:385
Including Qt Headers.
The opmon infrastructure has not been set up in the configuration
Definition util.hpp:28