39ConfigurationManager::ConfigurationManager(std::string
const& config_spec,
40 std::string
const& app_name,
41 std::string
const& session_name)
42 : m_confdb(new
conffwk::Configuration(config_spec))
43 , m_app_name(app_name)
44 , m_session_name(session_name)
46 TLOG() <<
"configSpec <" << config_spec <<
"> session name " << session_name <<
" application name " << app_name;
48 TLOG_DBG(
TLVL_SESSION) <<
"getting session " << session_name;
50 if (m_session ==
nullptr) {
51 TLOG() <<
"Failed to get session " << session_name;
54 m_helper = std::make_shared<appmodel::ConfigurationHelper>(m_session);
57std::vector<ValidationReport>
58ConfigurationManager::initialize(
bool throw_on_fatal)
60 std::vector<ValidationReport> reports;
64 TLOG_DBG(
TLVL_APP) <<
"getting app " << m_app_name;
66 if (m_application ==
nullptr) {
67 TLOG() <<
"Failed to get app " << m_app_name;
71 TLOG_DBG(
TLVL_APP) <<
"getting modules for app " << m_app_name;
73 if(daq_app ==
nullptr) {
74 throw(NotADaqApplication(
ERS_HERE, m_application->UID()));
78 if (smart_daq_app !=
nullptr) {
79 smart_daq_app->generate_modules(m_helper);
84 for (
auto& plan : m_application->get_action_plans()) {
85 auto cmd = plan->get_command()->get_cmd();
86 TLOG_DBG(
TLVL_ACTION_PLAN) <<
"Registering action plan " << plan->UID() <<
" for cmd " << cmd;
87 if (m_action_plans.count(cmd)) {
88 reports.emplace_back(ValidationReport::Severity::Fatal,
92 "Multiple ActionPlans registered for cmd, conflicting plan is " + plan->UID());
94 throw ActionPlanValidationFailed(
95 ERS_HERE, reports.back().get_command(), reports.back().get_module(), reports.back().get_message());
98 ERS_HERE, reports.back().get_command(), reports.back().get_module(), reports.back().get_message()));
100 m_action_plans[cmd] = plan;
103 m_connsvc_config = m_session->get_connectivity_service();
105 std::set<std::string> connectionsAdded;
106 for (
auto mod : m_modules) {
107 TLOG_DBG(
TLVL_MODULE) <<
"initialising " << mod->class_name() <<
" module " << mod->UID();
109 auto outputs = mod->get_outputs();
111 for (
auto con : connections) {
112 auto [
c, inserted] = connectionsAdded.insert(con->UID());
119 TLOG_DBG(
TLVL_QUEUE) <<
"Adding queue " << queue->UID();
120 m_queues.emplace_back(queue);
124 m_networkconnections.emplace_back(net_con);
129 m_initialized =
true;
134ConfigurationManager::get_action_plan(std::string cmd)
const
136 if (m_action_plans.count(cmd)) {
137 return m_action_plans.at(cmd);
const TARGET * cast() const noexcept
Casts object to different class.
const std::vector< const dunedaq::confmodel::DaqModule * > & get_modules() const
Get "modules" relationship value.
void error(const Issue &issue)