3 #include "ErrorHandler/MessageAnalyzer/ma_utils.h"
5 using namespace novadaq::errorhandler;
7 int novadaq::errorhandler::and_op (
int i,
int j)
11 if (i==-2 || j==-2)
return -2;
18 std::string novadaq::errorhandler::trim_hostname(std::string
const & host)
20 size_t pos = host.find(
'.');
21 if (pos==std::string::npos)
return host;
22 else return host.substr(0, pos);
25 node_type_t novadaq::errorhandler::get_source_from_msg(std::string & src,
qt_mf_msg const & msg)
27 std::string host = trim_hostname(msg.hostname());
29 if ( (host.find(
"dcm")!=std::string::npos) )
31 src = host;
return DCM;
33 else if (host.find(
"novadaq-ctrl-farm")!=std::string::npos)
35 src = host;
return BufferNode;
39 src = msg.application();
return MainComponent;
43 ma_cond_domain novadaq::errorhandler::domain_and(ma_cond_domain
const & d1, ma_cond_domain
const & d2)
45 return ma_cond_domain( and_op(d1.first, d2.first)
46 , and_op(d1.second, d2.second));
49 void domain_and( ma_cond_domain & d1, ma_cond_domain
const & d2 )
51 d1.first = and_op(d1.first, d2.first);
52 d1.second = and_op(d1.second, d2.second);
55 ma_cond_domain novadaq::errorhandler::domain_and(ma_cond_domains
const & d)
57 if (d.empty())
return ma_cond_domain(-2,-2);
59 ma_cond_domain d_out = d.front();
60 ma_cond_domains::const_iterator it = d.begin();
61 while(++it!=d.end()) domain_and(d_out, *it);
66 void novadaq::errorhandler::domain_and(ma_cond_domains & d)
70 d.push_back(ma_cond_domain(-2,-2));
74 ma_cond_domains::const_iterator it = d.begin();
75 while(++it!=d.end()) domain_and(d.front(), *it);
Qt wrapper around MessageFacility message