DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
appfwk
include
appfwk
detail
DAQModule.hxx
Go to the documentation of this file.
1
11
12
namespace
dunedaq::appfwk
{
13
14
template
<
typename
Child>
15
void
16
DAQModule::register_command(
const
std::string& cmd_name,
void
(Child::*f)(
const
CommandData_t&))
17
{
18
if
(!m_command_registration_allowed) {
19
throw
CommandRegistrationFailedMessage(
20
ERS_HERE
, get_name(), cmd_name,
"Registering commands is not allowed at this time"
);
21
}
22
using namespace
std::placeholders;
23
24
bool
done =
25
m_commands.emplace(cmd_name, std::bind(f,
dynamic_cast<
Child*
>
(
this
), _1)).second;
// NOLINT(modernize-avoid-bind)
26
if
(!done) {
27
// Throw here
28
throw
CommandRegistrationFailedMessage(
29
ERS_HERE
, get_name(), cmd_name,
"Emplacing command in command map failed, possible duplicate registration"
);
30
}
31
}
32
39
inline
std::shared_ptr<DAQModule>
40
make_module
(std::string
const
& plugin_name, std::string
const
& instance_name)
41
{
42
static
cet::BasicPluginFactory bpf(
"duneDAQModule"
,
"make"
);
43
44
std::shared_ptr<DAQModule> mod_ptr;
45
try
{
46
mod_ptr = bpf.makePlugin<std::shared_ptr<DAQModule>>(plugin_name, instance_name);
47
}
catch
(
const
cet::exception& cexpt) {
48
throw
DAQModuleCreationFailed(
ERS_HERE
, plugin_name, instance_name, cexpt);
49
}
50
return
mod_ptr;
51
}
52
}
// namespace dunedaq::appfwk
ERS_HERE
#define ERS_HERE
Definition
LocalContext.hpp:141
dunedaq::appfwk
Definition
Nljs.hpp:18
dunedaq::appfwk::make_module
std::shared_ptr< DAQModule > make_module(std::string const &plugin_name, std::string const &instance_name)
Load a DAQModule plugin and return a shared_ptr to the contained DAQModule class.
Definition
DAQModule.hxx:40
Generated on
for DUNE-DAQ by
1.17.0