artdaq_core  3.09.12
GeneratorMacros.hh
1 #ifndef artdaq_core_Plugins_GeneratorMacros_hh
2 #define artdaq_core_Plugins_GeneratorMacros_hh
3 
4 #include "artdaq-core/Plugins/FragmentGenerator.hh"
5 
6 namespace fhicl {
7 class ParameterSet;
8 }
9 
10 #include <memory>
11 #include "cetlib/compiler_macros.h"
12 
13 namespace artdaq {
19 typedef std::unique_ptr<artdaq::FragmentGenerator> makeFunc_t(fhicl::ParameterSet const& ps);
20 } // namespace artdaq
21 
22 #ifndef EXTERN_C_FUNC_DECLARE_START
23 #define EXTERN_C_FUNC_DECLARE_START extern "C" {
24 #endif
25 
26 #define DEFINE_ARTDAQ_GENERATOR(klass) \
27  \
32  EXTERN_C_FUNC_DECLARE_START \
33  std::unique_ptr<artdaq::FragmentGenerator> \
34  make(fhicl::ParameterSet const& ps) \
35  { \
36  return std::unique_ptr<artdaq::FragmentGenerator>(new klass(ps)); \
37  } \
38  }
39 
40 #endif /* artdaq_core_Plugins_GeneratorMacros_hh */
std::unique_ptr< artdaq::FragmentGenerator > makeFunc_t(fhicl::ParameterSet const &ps)
Constructs a FragmentGenerator instance, and returns a pointer to it.