DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
ConfigurationManager.hpp
Go to the documentation of this file.
1
12#ifndef APPFWK_INCLUDE_APPFWK_CONFIGURATIONMANAGER_HPP_
13#define APPFWK_INCLUDE_APPFWK_CONFIGURATIONMANAGER_HPP_
14
16
21#include "confmodel/Session.hpp"
23#include "logging/Logging.hpp" // NOTE: if ISSUES ARE DECLARED BEFORE include logging/Logging.hpp, TLOG_DEBUG<<issue wont work.
24
25#include <memory>
26#include <string>
27#include <unordered_map>
28#include <vector>
29
30namespace dunedaq {
31
32// Disable coverage collection LCOV_EXCL_START
34 NotADaqApplication,
35 "Application " << app << " is neither a DaqApplication nor a SmartDaqApplication ",
36 ((std::string)app))
37
38ERS_DECLARE_ISSUE(appfwk, MissingComponent, "No such component: " << what, ((std::string)what))
39
41 ActionPlanValidationFailed,
42 "Action plan validation failed: " << cmd << ", module " << module << ": " << message,
43 ((std::string)cmd)((std::string)module)((std::string)message))
44// Re-enable coverage collection LCOV_EXCL_STOP
45
46namespace appfwk {
47
48class ConfigurationManager
49{
50public:
51 ConfigurationManager(std::string const& config_spec, std::string const& app_name, std::string const& session_name);
52 std::vector<ValidationReport> initialize(bool throw_on_fatal = true);
53
54 const confmodel::Session* get_session() const { return m_session; }
55 const confmodel::Application* get_application()
56 {
57 initialize();
58 return m_application;
59 }
60
61 const std::vector<const confmodel::Queue*>& get_queues()
62 {
63 initialize();
64 return m_queues;
65 }
66 const std::vector<const confmodel::NetworkConnection*>& get_networkconnections()
67 {
68 initialize();
69 return m_networkconnections;
70 }
71 const std::vector<const confmodel::DaqModule*>& get_modules()
72 {
73 initialize();
74 return m_modules;
75 }
76 const confmodel::ConnectivityService* get_connectivity_service()
77 {
78 initialize();
79 return m_connsvc_config;
80 }
81
82 const std::unordered_map<std::string, const confmodel::ActionPlan*>& get_action_plans()
83 {
84 initialize();
85 return m_action_plans;
86 }
87 const confmodel::ActionPlan* get_action_plan(std::string cmd) const;
88
89 template<typename T>
90 const T* get_dal(const std::string& name)
91 {
92 return m_confdb->get<T>(name);
93 }
94
95 std::string get_app_name() const { return m_app_name; }
96
97private:
98 std::shared_ptr<conffwk::Configuration> m_confdb;
99 std::string m_app_name;
100 std::string m_session_name;
101
102 const confmodel::Session* m_session;
103 const confmodel::DaqApplication* m_application;
104 std::unordered_map<std::string, const confmodel::ActionPlan*> m_action_plans;
105 std::vector<const confmodel::DaqModule*> m_modules;
106 std::vector<const confmodel::Queue*> m_queues;
107 std::vector<const confmodel::NetworkConnection*> m_networkconnections;
108 const confmodel::ConnectivityService* m_connsvc_config;
109
110 bool m_initialized{ false };
111};
112
113} // namespace appfwk
114} // namespace dunedaq
115
116#endif // APPFWK_INCLUDE_APPFWK_CONFIGURATIONMANAGER_HPP_
#define ERS_DECLARE_ISSUE(namespace_name, class_name, message, attributes)
conffwk entry point
The DUNE-DAQ namespace.
Unsupported std::string uri Execution of command failed
Definition Issues.hpp:69
LED calibration failed to initialize
Definition SSPIssues.hpp:22