artdaq_mfextensions  v1_06_02
NodeInfo.h
1 #ifndef _NOVA_ERROR_HANDLER_NODE_INFO_H_
2 #define _NOVA_ERROR_HANDLER_NODE_INFO_H_
3 
4 #include "ErrorHandler/MessageAnalyzer/ma_utils.h"
5 
6 #include <QtWidgets/QListWidget>
7 
8 #include <list>
9 #include <map>
10 
11 namespace novadaq {
12 namespace errorhandler {
13 
14 enum node_status
15 {
16  NORMAL,
17  FIRST_WARNING,
18  FIRST_ERROR
19 };
20 
21 class NodeInfo
22 {
23 public:
24  msgs_sp_t msgs_ptr; // shared_ptr to msg list
25  sev_code_t highest_sev; // highest severity lvl
26  QListWidgetItem* item_ptr; // ptr to QListWidgetItem
27  node_type_t node_type; // node type (dcm, bn, or others)
28 
29  NodeInfo(node_type_t type, std::string const& key, QListWidget* parent, bool aow, bool aoe);
30 
31  node_status push_msg(qt_mf_msg const& msg);
32  QString msgs_to_string() const;
33 
34  std::string key_string() const { return key_str; }
35 
36  bool alarm_on_warning() const { return alarm_warning; }
37  bool alarm_on_error() const { return alarm_error; }
38 
39  void set_alarm_on_warning(bool flag)
40  {
41  alarm_warning = flag;
42  update_icon(highest_sev);
43  }
44  void set_alarm_on_error(bool flag)
45  {
46  alarm_error = flag;
47  update_icon(highest_sev);
48  }
49 
50  void reset();
51 
52 private:
53  QString get_caption(std::string const& key) const;
54  void get_icon_geometry(int& icon_w, int& icon_h) const;
55  void get_node_geometry(int& node_w, int& node_h) const;
56  void update_icon(sev_code_t sev);
57 
58 private:
59  std::string key_str;
60 
61  bool alarm_warning;
62  bool alarm_error;
63 
64 private:
65  static const size_t MAX_QUEUE = 10;
66 
67 public:
68  static const int MAINCOMPONENT_ICON_WIDTH = 34;
69  static const int MAINCOMPONENT_ICON_HEIGHT = 34;
70  static const int MAINCOMPONENT_NODE_WIDTH = 80;
71  static const int MAINCOMPONENT_NODE_HEIGHT = 65;
72 
73  static const int BUFFERNODE_ICON_WIDTH = 34;
74  static const int BUFFERNODE_ICON_HEIGHT = 34;
75  static const int BUFFERNODE_NODE_WIDTH = 65;
76  static const int BUFFERNODE_NODE_HEIGHT = 65;
77 
78  static const int DCM_ICON_WIDTH = 34;
79  static const int DCM_ICON_HEIGHT = 34;
80  static const int DCM_NODE_WIDTH = 65;
81  static const int DCM_NODE_HEIGHT = 65;
82 };
83 
84 } // end of namespace errorhandler
85 } // end of namespace novadaq
86 
87 Q_DECLARE_METATYPE(novadaq::errorhandler::msgs_t)
88 Q_DECLARE_METATYPE(novadaq::errorhandler::msgs_sp_t)
89 
90 #endif
Qt wrapper around MessageFacility message
Definition: qt_mf_msg.hh:37