artdaq_utilities  v1_05_00
MetricMacros.hh
1 #ifndef artdaq_Plugins_MetricMacros_hh
2 #define artdaq_Plugins_MetricMacros_hh
3 
4 #include "artdaq-utilities/Plugins/MetricPlugin.hh"
5 #include "fhiclcpp/fwd.h"
6 
7 #include "cetlib/compiler_macros.h"
8 
9 #include <memory>
10 
11 namespace artdaq {
18 typedef std::unique_ptr<artdaq::MetricPlugin> makeFunc_t(fhicl::ParameterSet const& ps, std::string const& app_name);
19 } // namespace artdaq
20 
21 #ifndef EXTERN_C_FUNC_DECLARE_START
22 #define EXTERN_C_FUNC_DECLARE_START extern "C" {
23 #endif
24 
25 #define DEFINE_ARTDAQ_METRIC(klass) \
26  EXTERN_C_FUNC_DECLARE_START \
27  std::unique_ptr<artdaq::MetricPlugin> \
28  make(fhicl::ParameterSet const& ps, std::string const& app_name) \
29  { \
30  return std::unique_ptr<artdaq::MetricPlugin>(new klass(ps, app_name)); \
31  } \
32  }
33 
34 #endif /* artdaq_Plugins_MetricMacros_hh */
std::unique_ptr< artdaq::MetricPlugin > makeFunc_t(fhicl::ParameterSet const &ps, std::string const &app_name)
Make a MetricPlugin instance, loading the plugin if necessary.
Definition: MetricMacros.hh:18