artdaq_mfextensions  v1_05_00
MsgAnalyzerDlg.h
1 #ifndef _NOVA_MSG_ANALYZER_DLG_H_
2 #define _NOVA_MSG_ANALYZER_DLG_H_
3 
4 #include "ui_MsgAnalyzerDlg.h"
5 
6 #include "ErrorHandler/MessageAnalyzer/ma_utils.h"
7 #include "ErrorHandler/Components/NodeInfo.h"
8 #include "ErrorHandler/Components/qt_rule_engine.h"
9 #include "mfextensions/Receivers/ReceiverManager.hh"
10 
11 #include <QtCore/QMutex>
12 #include <QtCore/QSignalMapper>
13 #include <QtWidgets/QMenu>
14 
15 #include <boost/regex.hpp>
16 #include <boost/shared_ptr.hpp>
17 
18 #include <map>
19 #include <list>
20 #include <string>
21 
22 namespace novadaq {
23 namespace errorhandler {
24 
25 typedef boost::regex regex_t;
26 typedef std::vector<regex_t> vregex_t;
27 
28 typedef std::map<std::string, NodeInfo * > map_t;
29 
30 enum display_field_t { DESCRIPTION, EXPRESSION };
31 
32 class MsgAnalyzerDlg : public QDialog, private Ui::MsgAnalyzerDlg
33 {
34  Q_OBJECT
35 
36 public:
37  MsgAnalyzerDlg( std::string const & cfgfile, int p
38  , QDialog *parent = 0 );
39 
40  virtual ~MsgAnalyzerDlg();
41 
42 protected:
43  void closeEvent(QCloseEvent *event) final;
44 
45 private slots:
46 
47  void onNewMsg(qt_mf_msg const & mfmsg);
48  void onNewSysMsg(sev_code_t, QString const & msg);
49 
50  void onNewAlarm( QString const & rule_name
51  , QString const & msg );
52  void onConditionMatch( QString const & name );
53 
54  void reset();
55  void exit();
56 
57  void onNodeClicked(QListWidgetItem * item);
58 
59  void show_main_context_menu(const QPoint & pos);
60  void show_dcm_context_menu(const QPoint & pos);
61  void show_evb_context_menu(const QPoint & pos);
62 
63  void context_menu_reset();
64  void context_menu_warning();
65  void context_menu_error();
66 
67  void rule_enable( );
68  void rule_disable( );
69  void rule_reset_selection( );
70  void reset_rule(int idx);
71  void reset_rule(QString);
72 
73 
74  void onRuleDesc( bool checked )
75  { rule_display = checked ? DESCRIPTION : EXPRESSION; updateRuleDisplay(); }
76  void onCondDesc( bool checked )
77  { cond_display = checked ? DESCRIPTION : EXPRESSION; updateCondDisplay(); }
78 
79  void onEstablishPartition(int partition);
80  void onSetParticipants( QVector<QString> const & dcm
81  , QVector<QString> const & bnevb);
82 
83 private:
84 
85  void reset_node_status();
86  void reset_rule_engine();
87 
88  void initNodeStatus();
89  void initParticipants();
90  void initRuleEngineTable();
91  void updateRuleDisplay();
92  void updateCondDisplay();
93 
94  void publishMessage( message_type_t type, QString const & msg ) const;
95 
96  void show_context_menu( QPoint const & pos, QListWidget * list );
97  bool check_node_aow( std::string const & key );
98  bool check_node_aoe( std::string const & key );
99 
100 private:
101 
102  // data member
103  fhicl::ParameterSet pset;
104  qt_rule_engine engine;
105  mfviewer::ReceiverManager receiver;
106 
107  map_t map;
108  int nmsgs;
109 
110  // number of rules/conditions
111  size_t rule_size;
112  size_t cond_size;
113 
114  // rule/cond name --> row index map
115  std::map<QString, int> rule_idx_map;
116  std::map<QString, int> cond_idx_map;
117 
118  // whether to show description or expression
119  display_field_t rule_display;
120  display_field_t cond_display;
121 
122  // map lock
123  QMutex map_lock;
124 
125  // signal mapper
126  QSignalMapper sig_mapper;
127 
128  // conext menu
129  QMenu * context_menu;
130  QMenu * rule_act_menu;
131  QMenu * cond_act_menu;
132 
133  // context menu actions
134  QAction * act_reset;
135  QAction * act_warning;
136  QAction * act_error;
137  QAction * act_rule_enable;
138  QAction * act_rule_disable;
139  QAction * act_rule_reset;
140 
141  // QListWidgetItem related to the context menu
142  QListWidgetItem * list_item;
143 
144  // Node Status related members
145  bool aow_any; // alarm on warning on any nodes
146  bool aoe_any; // alarm on error on any nodes
147  vregex_t e_aow; // regex expressions for aow
148  vregex_t e_aoe; // regex expressions for aoe
149  boost::smatch what_;
150 
151 };
152 
153 } // end of namespace errorhandler
154 } // end of namespace novadaq
155 
156 #endif
Qt wrapper around MessageFacility message
Definition: qt_mf_msg.hh:37
The ReceiverManager loads one or more receiver plugins and displays messages received by those plugin...