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