artdaq_core  v3_06_00
GeneratorMacros.hh
1 #ifndef artdaq_core_Generators_GeneratorMacros_hh
2 #define artdaq_core_Generators_GeneratorMacros_hh
3 
4 #include "artdaq-core/Generators/FragmentGenerator.hh"
5 #include "fhiclcpp/fwd.h"
6 
7 #include <memory>
8 #include "cetlib/compiler_macros.h"
9 
10 namespace artdaq {
16 typedef std::unique_ptr<artdaq::FragmentGenerator> makeFunc_t(fhicl::ParameterSet const& ps);
17 } // namespace artdaq
18 
19 #ifndef EXTERN_C_FUNC_DECLARE_START
20 #define EXTERN_C_FUNC_DECLARE_START extern "C" {
21 #endif
22 
23 #define DEFINE_ARTDAQ_GENERATOR(klass) \
24  \
29  EXTERN_C_FUNC_DECLARE_START \
30  std::unique_ptr<artdaq::FragmentGenerator> \
31  make(fhicl::ParameterSet const& ps) \
32  { \
33  return std::unique_ptr<artdaq::FragmentGenerator>(new klass(ps)); \
34  } \
35  }
36 
37 #endif /* artdaq_core_Generators_GeneratorMacros_hh */
std::unique_ptr< artdaq::FragmentGenerator > makeFunc_t(fhicl::ParameterSet const &ps)
Constructs a FragmentGenerator instance, and returns a pointer to it.