artdaq  v3_12_02
GeneratorMacros.hh
1 #ifndef artdaq_Application_GeneratorMacros_hh
2 #define artdaq_Application_GeneratorMacros_hh
3 
4 #include "artdaq/Generators/CommandableFragmentGenerator.hh"
5 
6 namespace fhicl {
7 class ParameterSet;
8 }
9 
10 #include "cetlib/compiler_macros.h"
11 
12 #include <memory>
13 
14 namespace artdaq {
20 typedef std::unique_ptr<artdaq::CommandableFragmentGenerator> makeFunc_t(fhicl::ParameterSet const& ps);
21 } // namespace artdaq
22 
23 #ifndef EXTERN_C_FUNC_DECLARE_START
24 #define EXTERN_C_FUNC_DECLARE_START extern "C" {
25 #endif
26 
27 #define DEFINE_ARTDAQ_COMMANDABLE_GENERATOR(klass) \
28  EXTERN_C_FUNC_DECLARE_START \
29  std::unique_ptr<artdaq::CommandableFragmentGenerator> \
30  make(fhicl::ParameterSet const& ps) \
31  { \
32  return std::unique_ptr<artdaq::CommandableFragmentGenerator>(new klass(ps)); \
33  } \
34  }
35 
36 #endif /* artdaq_Application_GeneratorMacros_hh */
std::unique_ptr< artdaq::CommandableFragmentGenerator > makeFunc_t(fhicl::ParameterSet const &ps)
Constructs a CommandableFragmentGenerator instance, and returns a pointer to it.