Line data Source code
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 0 : void ma_function_factory::reg(std::string const& func_name, gen_func_t f)
11 : {
12 0 : get_map().insert(std::make_pair(func_name, f));
13 0 : }
14 :
15 : ma_function*
16 0 : ma_function_factory::create_instance(std::string const& func_name)
17 : {
18 0 : gen_map_t::iterator it = get_map().find(func_name);
19 :
20 0 : if (it != get_map().end())
21 0 : return it->second();
22 :
23 0 : throw std::runtime_error("unknown function name while creating instance of ma_function");
24 : }
|