DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::appmodel::ConfigObjectFactory Class Reference

#include <ConfigObjectFactory.hpp>

Collaboration diagram for dunedaq::appmodel::ConfigObjectFactory:
[legend]

Public Member Functions

 ConfigObjectFactory (conffwk::Configuration *config, const std::string &dbfile, const std::string &app_uid)
 
 ConfigObjectFactory (const conffwk::DalObject *)
 
 ~ConfigObjectFactory ()
 
conffwk::ConfigObject create (const std::string &class_name, const std::string &id) const
 
conffwk::ConfigObject create_queue_obj (const QueueDescriptor *qdesc, std::string uid="") const
 
conffwk::ConfigObject create_queue_sid_obj (const QueueDescriptor *qdesc, uint32_t src_id) const
 
conffwk::ConfigObject create_queue_sid_obj (const QueueDescriptor *qdesc, const confmodel::DetectorStream *stream) const
 
conffwk::ConfigObject create_net_obj (const NetworkConnectionDescriptor *ndesc, std::string uid) const
 Helper function that gets a network connection config.
 
conffwk::ConfigObject create_net_obj (const NetworkConnectionDescriptor *ndesc) const
 
template<class T >
const T * get_dal (std::string uid) const
 
template<class T >
const T * get_dal (conffwk::ConfigObject &obj) const
 

Private Attributes

conffwk::Configurationm_config
 
std::string m_dbfile
 
std::string m_app_uid
 

Detailed Description

Definition at line 26 of file ConfigObjectFactory.hpp.

Constructor & Destructor Documentation

◆ ConfigObjectFactory() [1/2]

dunedaq::appmodel::ConfigObjectFactory::ConfigObjectFactory ( conffwk::Configuration * config,
const std::string & dbfile,
const std::string & app_uid )

Definition at line 7 of file ConfigObjectFactory.cpp.

10 : m_config(config),
11 m_dbfile(dbfile),
12 m_app_uid(app_uid) {
13
14 //FIXME: remove this hacky hack
16}
static void set_nolock_mode(bool nl)
Definition file.hpp:385

◆ ConfigObjectFactory() [2/2]

dunedaq::appmodel::ConfigObjectFactory::ConfigObjectFactory ( const conffwk::DalObject * parent)

Definition at line 20 of file ConfigObjectFactory.cpp.

20 :
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}

◆ ~ConfigObjectFactory()

dunedaq::appmodel::ConfigObjectFactory::~ConfigObjectFactory ( )

Definition at line 29 of file ConfigObjectFactory.cpp.

29 {
30 //FIXME: remove this hacky hack
32}

Member Function Documentation

◆ create()

conffwk::ConfigObject dunedaq::appmodel::ConfigObjectFactory::create ( const std::string & class_name,
const std::string & id ) const
nodiscard

Definition at line 35 of file ConfigObjectFactory.cpp.

36 {
38 m_config->create(m_dbfile, class_name, id, cfg_obj);
39 return cfg_obj;
40}
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.

◆ create_net_obj() [1/2]

conffwk::ConfigObject dunedaq::appmodel::ConfigObjectFactory::create_net_obj ( const NetworkConnectionDescriptor * ndesc) const
nodiscard

Definition at line 102 of file ConfigObjectFactory.cpp.

102 {
103 return create_net_obj(ndesc, this->m_app_uid);
104}
conffwk::ConfigObject create_net_obj(const NetworkConnectionDescriptor *ndesc, std::string uid) const
Helper function that gets a network connection config.

◆ create_net_obj() [2/2]

conffwk::ConfigObject dunedaq::appmodel::ConfigObjectFactory::create_net_obj ( const NetworkConnectionDescriptor * ndesc,
std::string app_uid ) const
nodiscard

Helper function that gets a network connection config.

Parameters
uidUnique ID name of the config object
ndescNetwork connection descriptor object

\ret OKS configuration object for the network connection

Definition at line 87 of file ConfigObjectFactory.cpp.

88 {
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}
conffwk::ConfigObject create(const std::string &class_name, const std::string &id) const

◆ create_queue_obj()

conffwk::ConfigObject dunedaq::appmodel::ConfigObjectFactory::create_queue_obj ( const QueueDescriptor * qdesc,
std::string uid = "" ) const
nodiscard

Definition at line 44 of file ConfigObjectFactory.cpp.

44 {
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}

◆ create_queue_sid_obj() [1/2]

conffwk::ConfigObject dunedaq::appmodel::ConfigObjectFactory::create_queue_sid_obj ( const QueueDescriptor * qdesc,
const confmodel::DetectorStream * stream ) const
nodiscard

Definition at line 71 of file ConfigObjectFactory.cpp.

72 {
73return create_queue_sid_obj(qdesc, stream->get_source_id());
74}
conffwk::ConfigObject create_queue_sid_obj(const QueueDescriptor *qdesc, uint32_t src_id) const

◆ create_queue_sid_obj() [2/2]

conffwk::ConfigObject dunedaq::appmodel::ConfigObjectFactory::create_queue_sid_obj ( const QueueDescriptor * qdesc,
uint32_t src_id ) const
nodiscard

Definition at line 57 of file ConfigObjectFactory.cpp.

57 {
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}

◆ get_dal() [1/2]

template<class T >
const T * dunedaq::appmodel::ConfigObjectFactory::get_dal ( conffwk::ConfigObject & obj) const
inline

Definition at line 75 of file ConfigObjectFactory.hpp.

75 {
76 return m_config->get<T>(obj);
77 }
void get(const std::string &class_name, const std::string &id, ConfigObject &object, unsigned long rlevel=0, const std::vector< std::string > *rclasses=0)
Get object by class name and object id (multi-thread safe).

◆ get_dal() [2/2]

template<class T >
const T * dunedaq::appmodel::ConfigObjectFactory::get_dal ( std::string uid) const
inline

Definition at line 70 of file ConfigObjectFactory.hpp.

70 {
71 return m_config->get<T>(uid);
72 }

Member Data Documentation

◆ m_app_uid

std::string dunedaq::appmodel::ConfigObjectFactory::m_app_uid
private

Definition at line 31 of file ConfigObjectFactory.hpp.

◆ m_config

conffwk::Configuration* dunedaq::appmodel::ConfigObjectFactory::m_config
private

Definition at line 29 of file ConfigObjectFactory.hpp.

◆ m_dbfile

std::string dunedaq::appmodel::ConfigObjectFactory::m_dbfile
private

Definition at line 30 of file ConfigObjectFactory.hpp.


The documentation for this class was generated from the following files: