artdaq_mfextensions  v1_05_00
ma_utils.cpp
1 
2 #if 0
3 #include "ErrorHandler/MessageAnalyzer/ma_utils.h"
4 
5 using namespace novadaq::errorhandler;
6 
7 int novadaq::errorhandler::and_op (int i, int j)
8 {
9  if (i==j) return i;
10 
11  if (i==-2 || j==-2) return -2;
12  if (i==-1) return j;
13  if (j==-1) return i;
14 
15  return -2;
16 }
17 
18 std::string novadaq::errorhandler::trim_hostname(std::string const & host)
19 {
20  size_t pos = host.find('.');
21  if (pos==std::string::npos) return host;
22  else return host.substr(0, pos);
23 }
24 
25 node_type_t novadaq::errorhandler::get_source_from_msg(std::string & src, qt_mf_msg const & msg)
26 {
27  std::string host = trim_hostname(msg.hostname());
28 
29  if ( (host.find("dcm")!=std::string::npos) )
30  {
31  src = host; return DCM;
32  }
33  else if (host.find("novadaq-ctrl-farm")!=std::string::npos)
34  {
35  src = host; return BufferNode;
36  }
37  else
38  {
39  src = msg.application(); return MainComponent;
40  }
41 }
42 
43 ma_cond_domain novadaq::errorhandler::domain_and(ma_cond_domain const & d1, ma_cond_domain const & d2)
44 {
45  return ma_cond_domain( and_op(d1.first, d2.first)
46  , and_op(d1.second, d2.second));
47 }
48 
49 void domain_and( ma_cond_domain & d1, ma_cond_domain const & d2 )
50 {
51  d1.first = and_op(d1.first, d2.first);
52  d1.second = and_op(d1.second, d2.second);
53 }
54 
55 ma_cond_domain novadaq::errorhandler::domain_and(ma_cond_domains const & d)
56 {
57  if (d.empty()) return ma_cond_domain(-2,-2);
58 
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);
62 
63  return d_out;
64 }
65 
66 void novadaq::errorhandler::domain_and(ma_cond_domains & d)
67 {
68  if (d.empty())
69  {
70  d.push_back(ma_cond_domain(-2,-2));
71  return;
72  }
73 
74  ma_cond_domains::const_iterator it = d.begin();
75  while(++it!=d.end()) domain_and(d.front(), *it);
76 }
77 
78 
79 #endif
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
Qt wrapper around MessageFacility message
Definition: qt_mf_msg.hh:37