artdaq_mfextensions  v1_06_02
ma_function.cpp
1 
2 #include "ErrorHandler/MessageAnalyzer/ma_function.h"
3 
4 using namespace novadaq::errorhandler;
5 
6 // ma_function class
7 
8 // ma_function_factory
9 
10 void ma_function_factory::reg(std::string const& func_name, gen_func_t f)
11 {
12  get_map().insert(std::make_pair(func_name, f));
13 }
14 
16 ma_function_factory::create_instance(std::string const& func_name)
17 {
18  gen_map_t::iterator it = get_map().find(func_name);
19 
20  if (it != get_map().end())
21  return it->second();
22 
23  throw std::runtime_error("unknown function name while creating instance of ma_function");
24 }