1 #ifndef ERROR_HANDLER_MA_RULE_H
2 #define ERROR_HANDLER_MA_RULE_H
5 #include "ErrorHandler/MessageAnalyzer/ma_utils.h"
6 #include "ErrorHandler/MessageAnalyzer/ma_condition.h"
7 #include "ErrorHandler/MessageAnalyzer/ma_domain_expr.h"
8 #include "ErrorHandler/MessageAnalyzer/ma_boolean_expr.h"
9 #include "ErrorHandler/MessageAnalyzer/ma_richmsg.h"
10 #include "ErrorHandler/MessageAnalyzer/ma_action.h"
13 #include <boost/shared_ptr.hpp>
14 #include <fhiclcpp/ParameterSet.h>
21 namespace errorhandler {
29 ma_rule( std::string
const & name
30 , std::string
const & desc
32 ,
int holdoff_time = 0 );
39 parse( std::string
const & cond_expr
40 , std::string
const & alarm_message
41 , fhicl::ParameterSet
const & actions
42 , cond_map_t * cond_map_ptr );
68 get_alarm_count()
const {
return alarm_count; }
71 const std::string & name()
const {
return name_;}
72 const std::string & description()
const {
return description_; }
73 const std::string & cond_expr()
const {
return condition_expr; }
74 const std::string & alarm_message()
const {
return alarm_msg.plain_message(); }
76 const std::vector<std::string> & cond_names()
const {
return cond_names_; }
80 enable(
bool flag ) { enabled = flag; }
91 { boolean_expr = expr; }
95 { domain_expr = expr; }
99 insert_condition_ptr( std::string
const & name,
bool primitive );
105 get_cond_idx( std::string
const & name )
const;
109 get_cond( std::string
const & name )
const;
113 get_idx( std::string
const & name )
const;
117 get_cond_size()
const;
122 update_notify_list( std::string
const & name, arg_t arg );
126 cond_vec_t conditions;
127 idx_t conditions_idx;
128 std::vector<bool> primitive_cond;
138 recursive_evaluate ( ma_domain & value
140 , ma_domain
const & domain
146 boolean_evaluate ( ma_domain & value
148 , ma_domain
const & domain );
151 parse_alarm_message ( std::string
const & s );
154 parse_alarm_ref( std::string
const & s );
160 cond_map_t * cond_map;
163 std::string description_;
164 std::string condition_expr;
167 std::vector<std::string> cond_names_;
176 std::map<ma_domain, timeval> alarms;
177 std::map<ma_domain, timeval>::const_iterator itor_last_alarm;
188 typedef boost::shared_ptr<ma_rule> rule_sp;
189 typedef std::map<std::string, ma_rule> rule_map_t;