FACT++  1.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
void MessageDimRX::infoHandler ( )
protectedvirtual

If the server has been disconnected write a simple log-message. Skip all received messages which have a severity smaller than fMinLogLevel. Write any other message with MessageImp::Write.

Implements DimInfoHandler.

Definition at line 132 of file MessageDim.cc.

References fConnected, fDimMessage, fMinLogLevel, fMsg, DimInfoHandler::getInfo(), DimInfo::getName(), DimInfo::getQuality(), DimInfo::getSize(), DimInfo::getString(), DimInfo::getTimestamp(), DimInfo::getTimestampMillisecs(), and MessageImp::Write().

Referenced by StateClient::infoHandler().

133 {
134  if (getInfo()!=&fDimMessage)
135  return;
136 
137  const string name = fDimMessage.getName();
138  const string server = name.substr(0, name.find_first_of('/'));
139 
141 
142  // The server is diconnected. Do nothing
143  if (!fConnected)
144  {
145  // We cannot print this message because it is produced by
146  // every server which doesn't have the MESSAGE service, too.
147  //fMsg.Message(server+": Disconnected.");
148  return;
149  }
150 
151  // skip all messages with a severity smaller than the minimum log level
153  return;
154 
155  const string msg = server+": "+fDimMessage.getString();
156 
157  // Make sure getTimestamp is called _before_ getTimestampMillisecs
158  // Must be in exactly this order!
159  const int tsec = fDimMessage.getTimestamp();
160  const int tms = fDimMessage.getTimestampMillisecs();
161 
162  // Write the received message to the output
163  fMsg.Write(Time(tsec, tms*1000), msg, fDimMessage.getQuality());
164 }
char * getString()
Definition: dic.hxx:108
bool fConnected
Definition: MessageDim.h:38
int getQuality()
Definition: diccpp.cxx:102
Adds some functionality to boost::posix_time::ptime for our needs.
Definition: Time.h:30
int getTimestampMillisecs()
Definition: diccpp.cxx:114
int getSize()
Definition: dic.hxx:100
virtual int Write(const Time &time, const std::string &txt, int qos=kMessage)
Definition: MessageImp.cc:133
int getTimestamp()
Definition: diccpp.cxx:107
int fMinLogLevel
Definition: MessageDim.h:37
DimStampedInfo fDimMessage
Definition: MessageDim.h:44
DimInfo * getInfo()
Definition: dic.hxx:26
MessageImp & fMsg
Definition: MessageDim.h:41
char * getName()
Definition: dic.hxx:101

+ Here is the call graph for this function:

+ Here is the caller graph for this function: