3 #ifndef CARMA_UI_RTD_SZARTDUTILS_H
4 #define CARMA_UI_RTD_SZARTDUTILS_H
15 #include "carma/ui/rtd/common/MonitorDisplay.h"
18 #include <boost/shared_ptr.hpp>
21 #define SZA_COL_ADD_FN(fn) std::vector<MonitorCellPtr> (fn)(carma::monitor::MonitorContainer* container, unsigned colWidth)
22 #define SZA_ROW_ADD_FN(fn) std::vector<MonitorCellPtr> (fn)(carma::monitor::MonitorContainer* container, unsigned colWidth)
23 #define SZA_LABEL_FN(fn) std::vector<std::string> (fn)()
24 #define SZA_CONTAINER_FN(fn) carma::monitor::MonitorContainer* (fn)(carma::monitor::SzaSubsystem& subsystem)
26 #define GENERIC_COLUMN_FN(fn) std::vector<SzaRtdUtils::RtdColumn*> (fn)(MonitorDisplay& display)
27 #define GENERIC_ROW_FN(fn) std::vector<SzaRtdUtils::RtdRow*> (fn)(MonitorDisplay& display)
29 #define CAN_RECEIVED_MP(container) \
30 SzaRtdUtils::cell_ = MonitorCellMapped::makeCell(colWidth, container->received(), "OFFLINE");\
31 SzaRtdUtils::colorMap_.clear();\
32 SzaRtdUtils::colorMap_["OFFLINE"] = RED_CELL_COLOR;\
33 SzaRtdUtils::cell_->setColorMap(SzaRtdUtils::colorMap_);\
34 SzaRtdUtils::cell_->setDefaultLabel("ONLINE");\
35 SzaRtdUtils::cell_->setDefaultColor(GREEN_CELL_COLOR);\
36 col.push_back(SzaRtdUtils::cell_);
38 #define BINARY_MAPPED_MP(mp, state1Label, state2Label, state1Color, state2Color) \
39 SzaRtdUtils::cell_ = MonitorCellMapped::makeCell(colWidth, mp, state1Label, state2Label);\
40 SzaRtdUtils::colorMap_.clear();\
41 SzaRtdUtils::colorMap_[state1Label] = state1Color;\
42 SzaRtdUtils::colorMap_[state2Label] = state2Color;\
43 SzaRtdUtils::cell_->setColorMap(SzaRtdUtils::colorMap_);\
44 col.push_back(SzaRtdUtils::cell_);
46 #define BOOLEAN_MAPPED_MP(mp, state1Label, state2Label, state1Color, state2Color) \
48 std::map<std::string, std::string> labelMap; \
49 labelMap["false"] = state1Label;\
50 labelMap["true"] = state2Label;\
51 SzaRtdUtils::cell_ = MonitorCellMapped::makeCell(colWidth, mp, labelMap);\
52 SzaRtdUtils::colorMap_.clear();\
53 SzaRtdUtils::colorMap_[state1Label] = state1Color;\
54 SzaRtdUtils::colorMap_[state2Label] = state2Color;\
55 SzaRtdUtils::cell_->setColorMap(SzaRtdUtils::colorMap_);\
56 col.push_back(SzaRtdUtils::cell_);\
59 #define BINARY_BIT_MAPPED_MP(mp, bit, state1Label, state2Label, state1Color, state2Color) \
60 SzaRtdUtils::cell_ = MonitorCellMapped::makeCell(colWidth, mp, bit, state1Label, state2Label); \
61 SzaRtdUtils::colorMap_.clear();\
62 SzaRtdUtils::colorMap_[state1Label] = state1Color;\
63 SzaRtdUtils::colorMap_[state2Label] = state2Color;\
64 SzaRtdUtils::cell_->setColorMap(SzaRtdUtils::colorMap_);\
65 col.push_back(SzaRtdUtils::cell_);
71 class MonitorCellMapped;
72 typedef boost::shared_ptr<MonitorCellMapped> MonitorCellMappedPtr;
81 container_ = &container;
92 container_ = &container;
107 virtual ~SzaRtdUtils();
111 static void addColumn(carma::monitor::SzaSubsystem& subsystem, RtTablePtr table,
112 SZA_CONTAINER_FN(*conFn), SZA_COL_ADD_FN(*fn),
unsigned colWidth);
115 SZA_COL_ADD_FN(*fn),
unsigned colWidth);
119 static void addTable(MonitorDisplay& display, RtFolderPtr folder, std::string tableName,
120 SZA_CONTAINER_FN(*conFn), SZA_COL_ADD_FN(*fn), SZA_LABEL_FN(*labFn),
unsigned colWidth);
122 static void addTable(MonitorDisplay& display, RtFolderPtr folder, std::string tableName,
123 GENERIC_COLUMN_FN(*columnFn), SZA_COL_ADD_FN(*columnAddFn), SZA_LABEL_FN(*rowLabelFn),
unsigned colWidth);
125 static void addTable(MonitorDisplay& display, RtFolderPtr folder, std::string tableName,
126 GENERIC_ROW_FN(*rowFn), SZA_ROW_ADD_FN(*rowAddFn), SZA_LABEL_FN(*colLabelFn),
127 std::vector<unsigned>& colWidths);
129 static void addTable(MonitorDisplay& display, RtFolderPtr folder, std::string tableName,
130 GENERIC_ROW_FN(*rowFn), SZA_ROW_ADD_FN(*rowAddFn), SZA_LABEL_FN(*colLabelFn),
135 static void addFolder(MonitorDisplay& display, std::string folderName,
136 SZA_CONTAINER_FN(*conFn), SZA_COL_ADD_FN(*colFn), SZA_LABEL_FN(*labFn),
unsigned colWidth);
138 static void addFolder(MonitorDisplay& display, std::string folderName,
139 GENERIC_COLUMN_FN(*columnFn), SZA_COL_ADD_FN(*columnAddFn), SZA_LABEL_FN(*rowLabelFn),
unsigned colWidth);
141 static void addFolder(MonitorDisplay& display, std::string folderName,
142 GENERIC_ROW_FN(*rowFn), SZA_ROW_ADD_FN(*rowAddFn), SZA_LABEL_FN(*columnLabelFn),
143 std::vector<unsigned>& colWidths);
145 static void addFolder(MonitorDisplay& display, std::string folderName,
146 GENERIC_ROW_FN(*rowFn), SZA_ROW_ADD_FN(*rowAddFn), SZA_LABEL_FN(*columnLabelFn),
152 static void addXacFolder(MonitorDisplay& display, std::string moduleName,
153 SZA_CONTAINER_FN(*conFn));
155 static void addCanModule(MonitorDisplay& display, std::string moduleName,
156 SZA_CONTAINER_FN(*conFn), SZA_COL_ADD_FN(*colFn), SZA_LABEL_FN(*labFn),
unsigned colWidth);
158 static SZA_LABEL_FN(getBiasLabels);
159 static SZA_COL_ADD_FN(getBiasColumn);
160 static SZA_CONTAINER_FN(getBiasContainer);
162 static SZA_COL_ADD_FN(getIntmodColumn);
163 static SZA_LABEL_FN(getIntmodLabels);
164 static SZA_CONTAINER_FN(getIntmodContainer);
166 static SZA_LABEL_FN(getVaractorLabels);
167 static SZA_COL_ADD_FN(getVaractorColumn);
168 static SZA_CONTAINER_FN(getVaractorContainer);
170 static SZA_LABEL_FN(getYigLabels);
171 static SZA_COL_ADD_FN(getYigColumn);
172 static SZA_CONTAINER_FN(getYigContainer);
174 static MonitorCellMappedPtr cell_;
175 static std::map<std::string, CellColor> colorMap_;
179 static const unsigned nSza_;
180 static const unsigned szaOffsetInCarma_;
182 static SZA_LABEL_FN(getXacLabels);
183 static SZA_COL_ADD_FN(getXacColumn);
193 #endif // End #ifndef CARMA_UI_RTD_SZARTDUTILS_H
The monitor system base class.
Cell that takes a MonitorPoint and displays its current value.
A generic monitor system container base class.