DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
DAQModule.cpp
Go to the documentation of this file.
1
10#include "logging/Logging.hpp"
11
12#include <string>
13#include <vector>
14
15namespace dunedaq::appfwk {
16
17void
18DAQModule::execute_command(const std::string& cmd_name, const data_t& data)
19{
20 auto cmd = m_commands.find(cmd_name);
21 if (cmd != m_commands.end()) {
22 std::invoke(cmd->second, data);
23 return;
24 }
25 throw UnknownCommand(ERS_HERE, get_name(), cmd_name);
26}
27
28std::vector<std::string>
29DAQModule::get_commands() const
30{
31 std::vector<std::string> cmds;
32 for (const auto& [key, value] : m_commands)
33 cmds.push_back(key);
34 return cmds;
35}
36
37bool
38DAQModule::has_command(const std::string& cmd_name) const
39{
40 return m_commands.find(cmd_name) != m_commands.end();
41}
42
43} // namespace dunedaq::appfwk
#define ERS_HERE