Line data Source code
1 :
2 : #include "ErrorHandler/MessageAnalyzer/ma_action.h"
3 :
4 : using namespace novadaq::errorhandler;
5 :
6 : // ma_function class
7 :
8 : // ma_function_factory
9 :
10 0 : void ma_action_factory::reg(std::string const& func_name, gen_act_t f)
11 : {
12 0 : get_map().insert(std::make_pair(func_name, f));
13 0 : }
14 :
15 : ma_action*
16 0 : ma_action_factory::create_instance(std::string const& func_name, ma_rule const* rule, pset_t const& pset)
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(rule, pset);
22 :
23 0 : throw std::runtime_error("unknown action name while creating instance of ma_action");
24 : }
|