DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
ConfigObjectFactory.cpp
Go to the documentation of this file.
1
4#include "oks/file.hpp"
5
6#include <fmt/core.h> // Replace with std::format when we switch to a newer compiler?
7
8namespace dunedaq {
9namespace appmodel {
10
12 : m_config(&parent->configuration())
13 , m_dbfile(parent->config_object().contained_in())
14 , m_app_uid(parent->UID())
15{
16
17 // FIXME: remove this hacky hack
19}
20
22{
23 // FIXME: remove this hacky hack
25}
26
28ConfigObjectFactory::create(const std::string& class_name, const std::string& id) const
29{
31 m_config->create(m_dbfile, class_name, id, cfg_obj);
32 return cfg_obj;
33}
34
35//---
37ConfigObjectFactory::create_queue_obj(const QueueDescriptor* qdesc, std::string uid) const
38{
39
40 std::string queue_uid(qdesc->get_uid_base() + uid);
41 auto queue_obj = create("Queue", queue_uid);
42 queue_obj.set_by_val<std::string>("data_type", qdesc->get_data_type());
43 queue_obj.set_by_val<std::string>("queue_type", qdesc->get_queue_type());
44 queue_obj.set_by_val<uint32_t>("capacity", qdesc->get_capacity());
45
46 return queue_obj;
47}
48
49//---
52{
53 std::string queue_uid(fmt::format("{}{}", qdesc->get_uid_base(), src_id));
54 auto queue_obj = create("QueueWithSourceId", queue_uid);
55
56 queue_obj.set_by_val<std::string>("data_type", qdesc->get_data_type());
57 queue_obj.set_by_val<std::string>("queue_type", qdesc->get_queue_type());
58 queue_obj.set_by_val<uint32_t>("capacity", qdesc->get_capacity());
59 queue_obj.set_by_val<uint32_t>("source_id", src_id);
60
61 return queue_obj;
62}
63
64//---
70
71//---
74{
75 std::string rdc_uid(fmt::format("{}{}", cdesc->get_uid_base(), src_id));
76 auto rdc_obj = create("DataMoveCallbackConf", rdc_uid);
77
78 rdc_obj.set_by_val<std::string>("data_type", cdesc->get_data_type());
79 rdc_obj.set_by_val<uint32_t>("source_id", src_id);
80
81 return rdc_obj;
82}
83//---
84
95{
96
97 auto svc_obj = ndesc->get_associated_service()->config_object();
98 std::string net_id = ndesc->get_uid_base() + app_uid;
99 auto net_obj = create("NetworkConnection", net_id);
100
101 net_obj.set_by_val<std::string>("data_type", ndesc->get_data_type());
102 net_obj.set_by_val<std::string>("connection_type", ndesc->get_connection_type());
103 net_obj.set_by_val<uint32_t>("capacity", ndesc->get_capacity());
104 net_obj.set_obj("associated_service", &svc_obj);
105
106 return net_obj;
107}
108
111{
112 return create_net_obj(ndesc, this->m_app_uid);
113}
114
115} // namespace appmodel
116} // namespace dunedaq
conffwk::ConfigObject create_queue_sid_obj(const QueueDescriptor *qdesc, uint32_t src_id) const
ConfigObjectFactory(const SmartDaqApplication *)
conffwk::ConfigObject create_callback_sid_obj(const DataMoveCallbackDescriptor *cdesc, 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.
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_uid_base() const
Get "uid_base" attribute value. Base for callback UID string. May be combined with a source id.
const std::string & get_data_type() const
Get "data_type" attribute value. string identifying type of data passed as a callback parameter.
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.
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. 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.
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:401
The DUNE-DAQ namespace.