2 #include "ErrorHandler/MessageAnalyzer/ma_function_countpercent.h"
3 #include "ErrorHandler/MessageAnalyzer/ma_condition.h"
4 #include "ErrorHandler/MessageAnalyzer/ma_participants.h"
6 #include <boost/algorithm/string.hpp>
8 using namespace novadaq::errorhandler;
15 if( args.empty() || args.size()<2 )
24 std::string type = boost::any_cast<std::string>(args[0]);
25 boost::to_upper(type);
27 if( type ==
"SOURCE" ) count_type = SOURCE;
28 else if( type ==
"TARGET" ) count_type = TARGET;
31 group = boost::any_cast<std::string>(args[1]);
37 ma_func_count_percent::evaluate(
ma_condition const & cond
38 , ma_cond_domain dom )
41 int count = cond.get_alarm_count( dom, count_type );
42 int total = ma_participants::instance().get_group_participant_count( group );
44 TLOG(TLVL_DEBUG) <<
"count = " << count <<
", participants = " << total;
46 return boost::any( (
double)count/total );