ModuleMacros.h
Go to the documentation of this file.
1 #ifndef art_Framework_Core_ModuleMacros_h
2 #define art_Framework_Core_ModuleMacros_h
3 
4 ////////////////////////////////////////////////////////////////////////
5 // ModuleMacros
6 //
7 // Defines the macro DEFINE_ART_MODULE(<module_classname>) to be used in
8 // XXX_module.cc to declare art modules (analyzers, filters, producers
9 // and outputs).
10 //
11 // Note: Libraries that include these symbol definitions cannot be
12 // linked into a main program as other libraries are. This is because
13 // the "one definition" rule would be violated.
14 //
15 ////////////////////////////////////////////////////////////////////////
16 
23 #include "fhiclcpp/ParameterSet.h"
25 
27 
28 #include <memory>
29 #include <ostream>
30 #include <string>
31 
32 // Function aliases (used in art).
33 namespace art {
34  namespace detail {
35  using WorkerMaker_t = Worker*(WorkerParams const&,
38  }
39 }
40 
41 // Produce the injected functions
42 #define DEFINE_ART_MODULE(klass) \
43  extern "C" { \
44  CET_PROVIDE_FILE_PATH() \
45  FHICL_PROVIDE_ALLOWED_CONFIGURATION(klass) \
46  art::Worker* \
47  make_worker(art::WorkerParams const& wp, art::ModuleDescription const& md) \
48  { \
49  return new klass::WorkerType( \
50  std::unique_ptr<klass::ModuleType>(new klass(wp.pset_)), md, wp); \
51  } \
52  art::ModuleType \
53  moduleType() \
54  { \
55  return art::detail::ModuleTypeDeducer<klass::ModuleType>::value; \
56  } \
57  }
58 
59 #endif /* art_Framework_Core_ModuleMacros_h */
60 
61 // Local Variables:
62 // mode: c++
63 // End:
Worker *(WorkerParams const &, ModuleDescription const &) WorkerMaker_t
Definition: ModuleMacros.h:36
ModuleType( ModuleTypeFunc_t)
Definition: ModuleMacros.h:37
Service to store calibration data products (CDP) in the SQLite3 metadatabase of a file...
Definition: FillParentInfo.h:8
ModuleType
Definition: ModuleType.h:22