artdaq_utilities  v1_04_10
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
12 {
19  typedef std::unique_ptr<artdaq::MetricPlugin> makeFunc_t(fhicl::ParameterSet const& ps, std::string const& app_name);
20 }
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) { \
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:19