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