artdaq_mfextensions  v1_06_02
ma_hitmap.h
1 #ifndef ERROR_HANDLER_MA_HITMAP_H
2 #define ERROR_HANDLER_MA_HITMAP_H
3 
4 #include "ErrorHandler/MessageAnalyzer/ma_cell.h"
5 #include "ErrorHandler/MessageAnalyzer/ma_domain_ops.h"
6 #include "ErrorHandler/MessageAnalyzer/ma_types.h"
7 #include "ErrorHandler/MessageAnalyzer/ma_utils.h"
8 
9 #include <map>
10 #include <string>
11 #include <vector>
12 
13 namespace novadaq {
14 namespace errorhandler {
15 
16 class ma_condition;
17 
18 class ma_hitmap
19 {
20 public:
21  ma_hitmap();
22 
23  void set_parent(ma_condition* parent) { cond = parent; }
24 
25  unsigned int capture(qt_mf_msg const& msg, std::string const& src, std::string const& tgt, boost::smatch const& what);
26 
27  bool event(size_t src, size_t tgt, time_t t);
28 
29  const static std::string global_s;
30  const static std::string global_t;
31 
32  // reset to ground state
33  void reset();
34 
35  // return index of the src/tgt string, or -2 if not found
36  int find_source(std::string const& src);
37  int find_target(std::string const& tgt);
38 
39  // get src/tgt string list
40  const idx_t& get_sources() const { return src_idx; }
41  const idx_t& get_targets() const { return tgt_idx; }
42 
43  // get size of src/tgt
44  size_t source_size() const { return src_idx.size(); }
45  size_t target_size() const { return tgt_idx.size(); }
46 
47  // get src/tgt string from idx
48  const std::string& get_source(ma_cond_domain v) const;
49  const std::string& get_target(ma_cond_domain v) const;
50 
51  std::string get_message(ma_cond_domain v) const;
52  std::string get_message_group(ma_cond_domain v, size_t g) const;
53 
54  // if the cell has been triggered
55  bool get_status(ma_cond_domain v) const;
56 
57  int get_alarm_count(ma_cond_domain v, arg_t arg) const;
58 
59  // get a range of src/target
60  void get_cond_range(ma_cond_domain d, ma_cond_range& src, ma_cond_range& tgt) const;
61 
62  // get a view to the hitmap
63  const hitmap_view_t
64  get_domain_view(ma_cond_domain const& d);
65 
66 private:
67  // increment size when the hitmap is resized
68  const static size_t cap_increment;
69 
70  idx_t src_idx;
71  idx_t tgt_idx;
72 
73  size_t src_cap;
74  size_t tgt_cap;
75 
76  ma_condition* cond;
77 
78  hitmap_t hitmap;
79 };
80 
81 } // end of namespace errorhandler
82 } // end of namespace novadaq
83 
84 #endif
Qt wrapper around MessageFacility message
Definition: qt_mf_msg.hh:37