artdaq_utilities  1.08.06
MetricMacros.hh
1 #ifndef artdaq_Plugins_MetricMacros_hh
2 #define artdaq_Plugins_MetricMacros_hh
3 
4 #include "artdaq-utilities/Plugins/MetricPlugin.hh"
5 namespace fhicl {
6 class ParameterSet;
7 }
8 #include "cetlib/compiler_macros.h"
9 
10 #include <memory>
11 
12 namespace artdaq {
19 typedef std::unique_ptr<artdaq::MetricPlugin> makeFunc_t(fhicl::ParameterSet const& ps, std::string const& app_name);
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_METRIC(klass) \
27  EXTERN_C_FUNC_DECLARE_START \
28  std::unique_ptr<artdaq::MetricPlugin> \
29  make(fhicl::ParameterSet const& ps, std::string const& app_name, std::string const& metric_name) \
30  { \
31  return std::unique_ptr<artdaq::MetricPlugin>(new klass(ps, app_name, metric_name)); \
32  } \
33  }
34 
35 #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:19