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;
56std::vector<ValidationReport>
57ConfigurationManager::initialize(
bool throw_on_fatal)
59 std::vector<ValidationReport> reports;
63 TLOG_DBG(
TLVL_APP) <<
"getting app " << m_app_name;
65 if (m_application ==
nullptr) {
66 TLOG() <<
"Failed to get app " << m_app_name;
70 TLOG_DBG(
TLVL_APP) <<
"getting modules for app " << m_app_name;
73 if(!daq_app && !smart_daq_app) {
74 throw(NotADaqApplication(
ERS_HERE, m_application->UID()));
78 smart_daq_app->generate_modules(m_session);
83 for (
auto& plan : m_application->get_action_plans()) {
84 auto cmd = plan->get_command()->get_cmd();
85 TLOG_DBG(
TLVL_ACTION_PLAN) <<
"Registering action plan " << plan->UID() <<
" for cmd " << cmd;
86 if (m_action_plans.count(cmd)) {
87 reports.emplace_back(ValidationReport::Severity::Fatal,
91 "Multiple ActionPlans registered for cmd, conflicting plan is " + plan->UID());
93 throw ActionPlanValidationFailed(
94 ERS_HERE, reports.back().get_command(), reports.back().get_module(), reports.back().get_message());
97 ERS_HERE, reports.back().get_command(), reports.back().get_module(), reports.back().get_message()));
99 m_action_plans[cmd] = plan;
102 m_connsvc_config = m_session->get_connectivity_service();
104 std::set<std::string> connectionsAdded;
105 for (
auto mod : m_modules) {
106 TLOG_DBG(
TLVL_MODULE) <<
"initialising " << mod->class_name() <<
" module " << mod->UID();
108 auto outputs = mod->get_outputs();
110 for (
auto con : connections) {
111 auto [
c, inserted] = connectionsAdded.insert(con->UID());
118 TLOG_DBG(
TLVL_QUEUE) <<
"Adding queue " << queue->UID();
119 m_queues.emplace_back(queue);
123 m_networkconnections.emplace_back(net_con);
128 m_initialized =
true;
133ConfigurationManager::get_action_plan(std::string cmd)
const
135 if (m_action_plans.count(cmd)) {
136 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.
virtual std::vector< const dunedaq::conffwk::DalObject * > get(const std::string &name, bool upcast_unregistered=true) const
Get values of relationships and results of some algorithms as a vector of dunedaq::conffwk::DalObject...
void error(const Issue &issue)