1 #ifndef ERROR_HANDLER_MA_ACTION_H
2 #define ERROR_HANDLER_MA_ACTION_H
8 #include "ErrorHandler/MessageAnalyzer/ma_types.h"
10 #include <fhiclcpp/ParameterSet.h>
12 #include <boost/any.hpp>
13 #include <boost/function.hpp>
16 namespace errorhandler {
21 typedef std::vector<boost::any> anys_t;
22 typedef fhicl::ParameterSet pset_t;
30 : parent_rule(*rule), parameter(pset) {}
33 virtual bool exec( ) = 0;
44 typedef std::vector<ma_action *> ma_actions;
46 typedef boost::function<ma_action * (ma_rule const *, pset_t const &)> gen_act_t;
50 typedef std::map<std::string, gen_act_t> gen_map_t;
55 reg( std::string
const & action_name, gen_act_t f );
58 create_instance( std::string
const & act_name,
ma_rule const * rule, pset_t
const & pset );
65 get_map() {
static gen_map_t map;
return map; }
72 { ma_action_factory::reg( act_name, f ); }
83 #define REG_MA_ACTION(act_name, class_name) \
85 class_name ## _maker_func( ma_rule const * r, fhicl::ParameterSet const & p ) \
86 { return new class_name( r, p ); } \
88 class_name ## _maker_func_global_var ( #act_name, class_name ## _maker_func );