1 #ifndef CARMA_UI_RTD_MONITORCELL_H
2 #define CARMA_UI_RTD_MONITORCELL_H
16 #include "carma/ui/rtd/common/RtDisplay.h"
23 #include <boost/shared_ptr.hpp>
35 class MonitorPointBool;
44 typedef boost::shared_ptr<MonitorCell> MonitorCellPtr;
67 AntennaMapper::Antenna* antenna_;
84 void cacheCurrentValue() {
86 std::ostringstream os;
88 os <<
"Inside CCV 0" << std::endl;
89 RtDisplay::appendToFile(os.str());
94 os <<
"Inside CCV 0a" << std::endl;
95 RtDisplay::appendToFile(os.str());
97 switch (mp_->getValuetype()) {
98 case carma::monitor::MONITOR_VALUE_TYPE_SHORT:
99 currVal_ = mp_->getMonitorPointSample(sampleNo_).getMonitorValue().sh;
101 case carma::monitor::MONITOR_VALUE_TYPE_INTEGER:
102 currVal_ = (int)mp_->getMonitorPointSample(sampleNo_).getMonitorValue().lo;
104 case carma::monitor::MONITOR_VALUE_TYPE_FLOAT:
105 currVal_ = (float)mp_->getMonitorPointSample(sampleNo_).getMonitorValue().fl;
107 case carma::monitor::MONITOR_VALUE_TYPE_DOUBLE:
108 currVal_ = (double)mp_->getMonitorPointSample(sampleNo_).getMonitorValue().db;
112 os <<
"Inside CCV 1" << std::endl;
113 RtDisplay::appendToFile(os.str());
115 ThrowCarmaError(
"Unhandled CARMA data type");
120 os <<
"Inside CCV 2" << std::endl;
121 RtDisplay::appendToFile(os.str());
124 ThrowCarmaError(
"A condition was set on the current frequency, but this cell has an invalid antenna descriptor");
127 os <<
"Inside CCV 3" << std::endl;
128 RtDisplay::appendToFile(os.str());
130 currVal_ = antenna_->frequency_.GHz();
133 os <<
"Inside CCV 4" << std::endl;
134 RtDisplay::appendToFile(os.str());
140 std::ostringstream os;
142 os <<
"Inside isSatisfied 0" << std::endl;
143 RtDisplay::appendToFile(os.str());
148 os <<
"Inside isSatisfied 1" << std::endl;
149 RtDisplay::appendToFile(os.str());
151 bool res = cond_.isSatisfiedBy(currVal_);
154 os <<
"Inside isSatisfied 2" << std::endl;
155 RtDisplay::appendToFile(os.str());
170 static MonitorCellPtr makeCell(
int cellWidth,
173 static MonitorCellPtr makeCell(
int cellWidth,
184 static MonitorCellPtr makeCell(
int cellWidth,
188 static MonitorCellPtr makeCell(
int cellWidth,
203 void setErrorColor(
CellColor errorColor );
204 void setWarnColor(
CellColor warnColor );
205 void setGoodColor(
CellColor goodColor );
207 void setGoodColorTextOverride( const ::std::string &
text,
210 void removeGoodColorTextOverride( const ::std::string & text );
212 std::string getName();
214 void setAntenna(AntennaMapper::Antenna* ant);
234 bool conditionsAreMet();
268 int getSampleNo( )
const;
277 virtual ::std::string computeText( );
291 static MonitorCellPtr makeCell(
int cellWidth,
296 static MonitorCellPtr makeCell(
int cellWidth,
302 typedef ::std::map< ::std::string, CellColor > StringToColorMap;
314 ::std::auto_ptr< StringToColorMap > goodColorTextOverrides_;
321 AntennaMapper::Antenna* antenna_;
325 std::vector<Condition> conditions_;
328 void initialize(
int w,
bool useW);
339 carma::monitor::MonitorPointComplex::stringValueReturnType
349 ::std::string computeText( );
355 carma::monitor::MonitorPointComplex::stringValueReturnType complexRep_;
360 class MonitorCellBool :
public MonitorCell {
361 friend class MonitorCell;
364 void overrideStateAppearances(
365 const ::std::string & trueStateText,
CellColor trueStateColour,
366 const ::std::string & falseStateText,
CellColor falseStateColour );
368 void clearOverrides( );
371 MonitorCellBool(
int cellWidth,
376 virtual ::std::string computeText( );
383 bool trueStateTextOverridden_;
384 ::std::string trueStateOverrideText_;
386 bool trueStateColourOverridden_;
389 bool falseStateTextOverridden_;
390 ::std::string falseStateOverrideText_;
392 bool falseStateColourOverridden_;
Tagged: Tue Jun 22 22:32:16 UTC 2004.
int setMpWidthToFormatLength()
Sets the monitor point width to the internal Cell Format width.
Classes that provide the pecializations of monitor points and sense poiints for different datatypes...
Exception class for errors.
Tagged: Sun Oct 24 17:05:09 PDT 2004.
::std::string text
Formatted text.
virtual ~MonitorCell()
destructor
Boolean value monitor point.
virtual void update()
Creates a new string that is the dynamic ascii contents of this object.
MonitorCell(int cellWidth, bool setMpWidth, monitor::MonitorPoint &monitorPoint, monitor::MonitorPoint &mpColor, int sampleNo)
Constructor.
Abstract base class for a monitor point.
Tagged: Tue Sep 24 14:08:19 PDT 2013.
virtual void updateColor()
Automatically called as part of the update cycle to set background color.
void setNotruncate()
Don't truncate value string; display stars if it overflows cell.
An abstract realtime (dynamic) text Cell.
A Cell that displays the current value of a MonitorPoint, with the background color gotten from a sec...
A class for handling a condition for a monitor point.
Complex value monitor point.
enum carma::ui::rtd::CellColorEnum CellColor
Cell color choices.