CARMA C++
CorrModeCell.h
1 #include "carma/ui/rtd/common/RtDisplay.h"
4 #include <string>
5 
6 namespace carma {
7 namespace ui {
8 namespace rtd {
9 
10 class CorrModeCell : public MonitorCell {
11  public:
26  CorrModeCell( int cellWidth,
27  carma::monitor::MonitorPoint & monitorPoint);
28  virtual ~CorrModeCell();
29  virtual CellColor computeColor();
30  protected:
31  // No copying
32  CorrModeCell( const CorrModeCell & rhs );
33  CorrModeCell& operator=( const CorrModeCell & rhs );
34 
35 };
36 
37 carma::ui::rtd::CorrModeCell::CorrModeCell( int cellWidth,
38  carma::monitor::MonitorPoint & monitorPoint) :
39  carma::ui::rtd::MonitorCell(cellWidth, true, monitorPoint, 1)
40 {
41 }
42 
43 carma::ui::rtd::CorrModeCell::~CorrModeCell()
44 {
45 }
46 
48 carma::ui::rtd::CorrModeCell::computeColor()
49 {
50  if (isGrayedOut()) return LIGHT_GRAY_TEXT_CELL_COLOR;
51 
53 
54  if ( sampleNo_ == 0 )
55  validity = mp_.getAveValidity( );
56  else
57  validity = mp_.getValidity( sampleNo_ - 1 );
58 
59  CellColor result = defaultGoodColor_;
60 
61  switch ( validity ) {
62  case carma::monitor::MonitorPoint::VALID_ERROR_HIGH:
63  case carma::monitor::MonitorPoint::VALID_ERROR_LOW:
64  case carma::monitor::MonitorPoint::VALID_ERROR:
65  result = computeErrorColor( );
66  break;
67 
68  case carma::monitor::MonitorPoint::VALID_WARNING_HIGH:
69  case carma::monitor::MonitorPoint::VALID_WARNING_LOW:
70  case carma::monitor::MonitorPoint::VALID_WARNING:
71  result = computeWarnColor( );
72  break;
73 
74  default:
75  const ::std::string text = computeText();
76  // search for any band offline indicated by "X"
77  if ( text.find("X") != ::std::string::npos )
78  result = computeWarnColor( );
79  else
80  result = computeGoodColor( );
81  break;
82  }
83 
84  return result;
85 
86 }
87 
88 } // namespace ui
89 } // namespace rtd
90 } // namespace carma
VALIDITY
Validity states of the data value.
Definition: MonitorPoint.h:132
Abstract base class for all monitor points.
Cell that takes a MonitorPoint and displays its current value.
Abstract base class for a monitor point.
Definition: MonitorPoint.h:68
enum carma::ui::rtd::CellColorEnum CellColor
Cell color choices.