DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
ConfigObjectFactory.hpp
Go to the documentation of this file.
1
10#ifndef APPMODEL_INCLUDE_OBJECTFACTORY_HPP_
11#define APPMODEL_INCLUDE_OBJECTFACTORY_HPP_
12
18
21
24
25#include <cstdint>
26#include <string>
27#include <vector>
28
29namespace dunedaq::appmodel {
30
32{
33
35 std::string m_dbfile;
36 std::string m_app_uid;
37
38public:
40
42
43 [[nodiscard]] conffwk::ConfigObject
44 create(const std::string& class_name, const std::string& id) const;
45
46 //---
47 [[nodiscard]] conffwk::ConfigObject
48 create_queue_obj(const QueueDescriptor* qdesc, std::string uid = "") const;
49
50 //---
51 [[nodiscard]] conffwk::ConfigObject
52 create_queue_sid_obj(const QueueDescriptor* qdesc, uint32_t src_id) const;
53
54 //---
55 [[nodiscard]] conffwk::ConfigObject
56 create_queue_sid_obj(const QueueDescriptor* qdesc, const confmodel::DetectorStream* stream) const;
57
58 //---
60 uint32_t src_id) const;
61
70 [[nodiscard]] conffwk::ConfigObject
71 create_net_obj(const NetworkConnectionDescriptor* ndesc, std::string uid) const;
72
73 [[nodiscard]] conffwk::ConfigObject
75
76 template<class T>
77 const T* get_dal(std::string uid) const {
78 return m_config->get<T>(uid);
79 }
80
81 template<class T>
83 return m_config->get<T>(obj);
84 }
85
86 void
87 update_modules(const std::vector<const confmodel::DaqModule*>& modules) {
89 if (!app->get_modules().empty()) {
90 throw (BadConf(ERS_HERE,
91 "SmartDaqApplication contains DaqModules which would be overwritten by generated DaqModules"));
92 }
93 if (!modules.empty()) {
94 const_cast<SmartDaqApplication*>(app)->set_modules(modules);
96 }
97 }
98
99};
100
101} // namespace dunedaq::appmodel
102
103#endif // APPMODEL_INCLUDE_OBJECTFACTORY_HPP_
#define ERS_HERE
void update_modules(const std::vector< const confmodel::DaqModule * > &modules)
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.
const T * get_dal(conffwk::ConfigObject &obj) const
const T * get_dal(std::string uid) const
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
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).
void update(const std::vector< std::string > &modified, const std::vector< std::string > &removed, const std::vector< std::string > &created) noexcept
Update cache of objects in case of modification.
conffwk entry point
msgpack::object obj