DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
appmodel
src
ConfigObjectFactory.cpp
Go to the documentation of this file.
1
2
#include "
ConfigObjectFactory.hpp
"
3
#include "
confmodel/Service.hpp
"
4
#include "
oks/file.hpp
"
5
6
#include <fmt/core.h>
// Replace with std::format when we switch to a newer compiler?
7
8
namespace
dunedaq
{
9
namespace
appmodel
{
10
11
ConfigObjectFactory::ConfigObjectFactory
(
const
SmartDaqApplication
* parent) :
12
m_config
(&parent->configuration()),
13
m_dbfile
(parent->config_object().contained_in()),
14
m_app_uid
(parent->UID()) {
15
16
//FIXME: remove this hacky hack
17
oks::OksFile::set_nolock_mode
(
true
);
18
}
19
20
ConfigObjectFactory::~ConfigObjectFactory
() {
21
//FIXME: remove this hacky hack
22
oks::OksFile::set_nolock_mode
(
false
);
23
}
24
25
conffwk::ConfigObject
26
ConfigObjectFactory::create
(
const
std::string& class_name,
27
const
std::string&
id
)
const
{
28
conffwk::ConfigObject
cfg_obj;
29
m_config
->create(
m_dbfile
, class_name,
id
, cfg_obj);
30
return
cfg_obj;
31
}
32
33
//---
34
conffwk::ConfigObject
35
ConfigObjectFactory::create_queue_obj
(
const
QueueDescriptor
* qdesc, std::string uid)
const
{
36
37
std::string queue_uid(qdesc->
get_uid_base
() + uid);
38
auto
queue_obj =
create
(
"Queue"
, queue_uid);
39
queue_obj.set_by_val<std::string>(
"data_type"
, qdesc->
get_data_type
());
40
queue_obj.set_by_val<std::string>(
"queue_type"
, qdesc->
get_queue_type
());
41
queue_obj.set_by_val<uint32_t>(
"capacity"
, qdesc->
get_capacity
());
42
43
return
queue_obj;
44
}
45
46
//---
47
conffwk::ConfigObject
48
ConfigObjectFactory::create_queue_sid_obj
(
const
QueueDescriptor
* qdesc, uint32_t src_id)
const
{
49
std::string queue_uid(fmt::format(
"{}{}"
, qdesc->
get_uid_base
(), src_id));
50
auto
queue_obj =
create
(
"QueueWithSourceId"
, queue_uid);
51
52
queue_obj.set_by_val<std::string>(
"data_type"
, qdesc->
get_data_type
());
53
queue_obj.set_by_val<std::string>(
"queue_type"
, qdesc->
get_queue_type
());
54
queue_obj.set_by_val<uint32_t>(
"capacity"
, qdesc->
get_capacity
());
55
queue_obj.set_by_val<uint32_t>(
"source_id"
, src_id);
56
57
return
queue_obj;
58
}
59
60
//---
61
conffwk::ConfigObject
62
ConfigObjectFactory::create_queue_sid_obj
(
const
QueueDescriptor
* qdesc,
63
const
confmodel::DetectorStream
* stream)
const
{
64
return
create_queue_sid_obj
(qdesc, stream->
get_source_id
());
65
}
66
67
//---
68
conffwk::ConfigObject
69
ConfigObjectFactory::create_callback_sid_obj
(
const
DataMoveCallbackDescriptor
* cdesc, uint32_t src_id)
const
70
{
71
std::string rdc_uid(fmt::format(
"{}{}"
, cdesc->
get_uid_base
(), src_id));
72
auto
rdc_obj =
create
(
"DataMoveCallbackConf"
, rdc_uid);
73
74
rdc_obj.set_by_val<std::string>(
"data_type"
, cdesc->
get_data_type
());
75
rdc_obj.set_by_val<uint32_t>(
"source_id"
, src_id);
76
77
return
rdc_obj;
78
}
79
//---
80
89
conffwk::ConfigObject
90
ConfigObjectFactory::create_net_obj
(
const
NetworkConnectionDescriptor
* ndesc,
91
std::string app_uid)
const
{
92
93
auto
svc_obj = ndesc->
get_associated_service
()->
config_object
();
94
std::string net_id = ndesc->
get_uid_base
() + app_uid;
95
auto
net_obj =
create
(
"NetworkConnection"
, net_id);
96
97
net_obj.set_by_val<std::string>(
"data_type"
, ndesc->
get_data_type
());
98
net_obj.set_by_val<std::string>(
"connection_type"
, ndesc->
get_connection_type
());
99
net_obj.set_by_val<uint32_t>(
"capacity"
, ndesc->
get_capacity
());
100
net_obj.set_obj(
"associated_service"
, &svc_obj);
101
102
return
net_obj;
103
}
104
105
conffwk::ConfigObject
106
ConfigObjectFactory::create_net_obj
(
const
NetworkConnectionDescriptor
* ndesc)
const
{
107
return
create_net_obj
(ndesc, this->
m_app_uid
);
108
}
109
110
}
// namespace appmodel
111
}
// namespace dunedaq
ConfigObjectFactory.hpp
dunedaq::appmodel::ConfigObjectFactory::m_dbfile
std::string m_dbfile
Definition
ConfigObjectFactory.hpp:35
dunedaq::appmodel::ConfigObjectFactory::create_queue_sid_obj
conffwk::ConfigObject create_queue_sid_obj(const QueueDescriptor *qdesc, uint32_t src_id) const
Definition
ConfigObjectFactory.cpp:48
dunedaq::appmodel::ConfigObjectFactory::ConfigObjectFactory
ConfigObjectFactory(const SmartDaqApplication *)
Definition
ConfigObjectFactory.cpp:11
dunedaq::appmodel::ConfigObjectFactory::m_app_uid
std::string m_app_uid
Definition
ConfigObjectFactory.hpp:36
dunedaq::appmodel::ConfigObjectFactory::~ConfigObjectFactory
~ConfigObjectFactory()
Definition
ConfigObjectFactory.cpp:20
dunedaq::appmodel::ConfigObjectFactory::create_callback_sid_obj
conffwk::ConfigObject create_callback_sid_obj(const DataMoveCallbackDescriptor *cdesc, uint32_t src_id) const
Definition
ConfigObjectFactory.cpp:69
dunedaq::appmodel::ConfigObjectFactory::create_net_obj
conffwk::ConfigObject create_net_obj(const NetworkConnectionDescriptor *ndesc, std::string uid) const
Helper function that gets a network connection config.
Definition
ConfigObjectFactory.cpp:90
dunedaq::appmodel::ConfigObjectFactory::create_queue_obj
conffwk::ConfigObject create_queue_obj(const QueueDescriptor *qdesc, std::string uid="") const
Definition
ConfigObjectFactory.cpp:35
dunedaq::appmodel::ConfigObjectFactory::create
conffwk::ConfigObject create(const std::string &class_name, const std::string &id) const
Definition
ConfigObjectFactory.cpp:26
dunedaq::appmodel::ConfigObjectFactory::m_config
conffwk::Configuration * m_config
Definition
ConfigObjectFactory.hpp:34
dunedaq::appmodel::DataMoveCallbackDescriptor
Definition
DataMoveCallbackDescriptor.hpp:20
dunedaq::appmodel::DataMoveCallbackDescriptor::get_uid_base
const std::string & get_uid_base() const
Get "uid_base" attribute value. Base for callback UID string. May be combined with a source id.
Definition
DataMoveCallbackDescriptor.hpp:94
dunedaq::appmodel::DataMoveCallbackDescriptor::get_data_type
const std::string & get_data_type() const
Get "data_type" attribute value. string identifying type of data passed as a callback parameter.
Definition
DataMoveCallbackDescriptor.hpp:127
dunedaq::appmodel::NetworkConnectionDescriptor
Definition
NetworkConnectionDescriptor.hpp:29
dunedaq::appmodel::NetworkConnectionDescriptor::get_connection_type
const std::string & get_connection_type() const
Get "connection_type" attribute value.
Definition
NetworkConnectionDescriptor.hpp:151
dunedaq::appmodel::NetworkConnectionDescriptor::get_data_type
const std::string & get_data_type() const
Get "data_type" attribute value. string identifying type of data transferred through this connection.
Definition
NetworkConnectionDescriptor.hpp:214
dunedaq::appmodel::NetworkConnectionDescriptor::get_capacity
uint32_t get_capacity() const
Get "capacity" attribute value.
Definition
NetworkConnectionDescriptor.hpp:182
dunedaq::appmodel::NetworkConnectionDescriptor::get_uid_base
const std::string & get_uid_base() const
Get "uid_base" attribute value. Base for UID string. To be combined with a source id.
Definition
NetworkConnectionDescriptor.hpp:110
dunedaq::appmodel::NetworkConnectionDescriptor::get_associated_service
const dunedaq::confmodel::Service * get_associated_service() const
Get "associated_service" relationship value. Service provided by this connection.
Definition
NetworkConnectionDescriptor.hpp:254
dunedaq::appmodel::QueueDescriptor
Definition
QueueDescriptor.hpp:20
dunedaq::appmodel::QueueDescriptor::get_queue_type
const std::string & get_queue_type() const
Get "queue_type" attribute value. Type of queue.
Definition
QueueDescriptor.hpp:144
dunedaq::appmodel::QueueDescriptor::get_data_type
const std::string & get_data_type() const
Get "data_type" attribute value. string identifying type of data transferred through this queue.
Definition
QueueDescriptor.hpp:208
dunedaq::appmodel::QueueDescriptor::get_capacity
uint32_t get_capacity() const
Get "capacity" attribute value.
Definition
QueueDescriptor.hpp:176
dunedaq::appmodel::QueueDescriptor::get_uid_base
const std::string & get_uid_base() const
Get "uid_base" attribute value. Base for UID string. May be combined with a source id.
Definition
QueueDescriptor.hpp:100
dunedaq::appmodel::SmartDaqApplication
Definition
SmartDaqApplication.hpp:42
dunedaq::conffwk::DalObject::config_object
const ConfigObject & config_object() const
Definition
DalObject.hpp:206
dunedaq::confmodel::DetectorStream
Definition
DetectorStream.hpp:32
dunedaq::confmodel::DetectorStream::get_source_id
uint32_t get_source_id() const
Get "source_id" attribute value.
Definition
DetectorStream.hpp:103
dunedaq::oks::OksFile::set_nolock_mode
static void set_nolock_mode(bool nl)
Definition
file.hpp:390
file.hpp
Service.hpp
conffwk.ConfigObject
Definition
ConfigObject.py:1
dunedaq::appmodel
Definition
CardControllerWrapper.hpp:21
dunedaq
Including Qt Headers.
Definition
module.cpp:16
Generated on
for DUNE-DAQ by
1.17.0