CARMA C++
MonitorCellMapped.h
Go to the documentation of this file.
1 // $Id: MonitorCellMapped.h,v 1.5 2013/11/19 03:41:12 iws Exp $
2 
3 #ifndef CARMA_UI_RTD_MONITORCELLMAPPED_H
4 #define CARMA_UI_RTD_MONITORCELLMAPPED_H
5 
16 #include <boost/shared_ptr.hpp>
17 
18 #define MP_BITMASK_FORMAT_FN(fn) unsigned (fn)(carma::monitor::MonitorPoint& mp, int iSamp, int iBit)
19 
20 namespace carma {
21  namespace ui {
22  namespace rtd {
23 
24  class MonitorCellMapped;
25  typedef boost::shared_ptr<MonitorCellMapped> MonitorCellMappedPtr;
26 
27  class MonitorCellMapped : public MonitorCell {
28  public:
29 
33  MonitorCellMapped( int cellWidth,
34  bool setMpWidth,
35  monitor::MonitorPoint& monitorPoint,
36  int sampleNo,
37  std::map<std::string, std::string> labelMap);
38 
39  MonitorCellMapped( int cellWidth,
40  monitor::MonitorPoint& monitorPoint,
41  std::map<std::string, std::string> labelMap);
42 
43  static MonitorCellMappedPtr makeCell(const int cellWidth,
44  monitor::MonitorPoint& mp,
45  std::map<std::string, std::string> labelMap);
46 
47  // Constructor for one bit in a bitmask
48 
49  static MonitorCellMappedPtr makeCell(const int cellWidth,
50  monitor::MonitorPoint& mp,
51  int iBit,
52  std::map<std::string, std::string> labelMap);
53 
54  static MonitorCellMappedPtr makeCell(const int cellWidth,
55  monitor::MonitorPoint& mp);
56 
57  static MonitorCellMappedPtr makeCell(const int cellWidth,
58  monitor::MonitorPoint& mp,
59  std::string state0);
60 
61  static MonitorCellMappedPtr makeCell(const int cellWidth,
62  monitor::MonitorPoint& mp,
63  std::string state0,
64  std::string state1);
65 
66  // Constructor for one bit in a bitmask
67 
68  static MonitorCellMappedPtr makeCell(const int cellWidth,
69  monitor::MonitorPoint& mp,
70  int iBit,
71  std::string state0,
72  std::string state1);
73 
74  static MonitorCellMappedPtr makeCell(const int cellWidth,
75  monitor::MonitorPoint& mp,
76  std::string state0,
77  std::string state1,
78  std::string state2);
79 
80  static MonitorCellMappedPtr makeCell(const int cellWidth,
81  monitor::MonitorPoint& mp,
82  std::string state0,
83  std::string state1,
84  std::string state2,
85  std::string state3);
86 
87  static MonitorCellMappedPtr makeCell(const int cellWidth,
88  monitor::MonitorPoint& mp,
89  std::string state0,
90  std::string state1,
91  std::string state2,
92  std::string state3,
93  std::string state4);
94 
95  static MonitorCellMappedPtr makeCell(const int cellWidth,
96  monitor::MonitorPoint& mp,
97  std::string state0,
98  std::string state1,
99  std::string state2,
100  std::string state3,
101  std::string state4,
102  std::string state5);
103 
104  static MonitorCellMappedPtr makeCell(const int cellWidth,
105  monitor::MonitorPoint& mp,
106  std::string state0,
107  std::string state1,
108  std::string state2,
109  std::string state3,
110  std::string state4,
111  std::string state5,
112  std::string state6);
113 
114  static MonitorCellMappedPtr makeCell(const int cellWidth,
115  monitor::MonitorPoint& mp,
116  std::string state0,
117  std::string state1,
118  std::string state2,
119  std::string state3,
120  std::string state4,
121  std::string state5,
122  std::string state6,
123  std::string state7);
124 
128  virtual ~MonitorCellMapped();
129 
130  virtual ::std::string computeText();
131 
132  void setBit(int iBit);
133 
134  void setDefaultLabel(std::string defaultLabel);
135  void setDefaultColor(CellColor);
136  void setColorMap(std::map<std::string, CellColor>& colorMap);
137 
138  CellColor computeColor();
139 
140  private:
141 
142  MP_BITMASK_FORMAT_FN(*formatFn_);
143 
144  int iBit_;
145 
146  std::map<std::string, std::string> labelMap_;
147  std::map<std::string, CellColor> colorMap_;
148 
149  std::string defaultLabel_;
150  CellColor defaultColor_;
151  CellColor currentColor_;
152 
153  void privateConstructor(monitor::MonitorPoint& mp,
154  std::map<std::string, std::string> labelMap);
155 
156  static MP_BITMASK_FORMAT_FN(formatByte);
157  static MP_BITMASK_FORMAT_FN(formatShort);
158  static MP_BITMASK_FORMAT_FN(formatBool);
159  static MP_BITMASK_FORMAT_FN(formatInt);
160 
161  }; // End class MonitorCellMapped
162 
163  } // End namespace rtd
164  } // End namespace ui
165 } // End namespace carma
166 
167 
168 
169 #endif // End #ifndef CARMA_MONITOR_UI_RTD_MONITORCELLMAPPED_H
Cell that takes a MonitorPoint and displays its current value.
enum carma::ui::rtd::CellColorEnum CellColor
Cell color choices.