Homepage Demos Overview Downloads Tutorials Reference
Credits

TextMsgEvent.cc

Go to the documentation of this file.
00001 #include "TextMsgEvent.h"
00002 #include <sstream>
00003 
00004 std::string
00005 TextMsgEvent::getDescription(bool showTypeSpecific/*=true*/, unsigned int verbosity/*=0*/) const {
00006   if(!showTypeSpecific)
00007     return EventBase::getDescription(showTypeSpecific,verbosity);
00008   std::ostringstream logdata;
00009   logdata << EventBase::getDescription(showTypeSpecific,verbosity) << '\t' << _text;
00010   return logdata.str();
00011 }
00012 
00013 unsigned int
00014 TextMsgEvent::getBinSize() const {
00015   unsigned int used=EventBase::getBinSize();
00016   used+=creatorSize("EventBase::TextMsgEvent");
00017   used+=_text.size()+stringpad;
00018   //used+=sizeof(_token);
00019   return used;
00020 }
00021 
00022 unsigned int
00023 TextMsgEvent::LoadBuffer(const char buf[], unsigned int len) {
00024   unsigned int origlen=len;
00025   unsigned int used;
00026   if(0==(used=EventBase::LoadBuffer(buf,len))) return 0;
00027   len-=used; buf+=used;
00028   if(0==(used=checkCreator("EventBase::TextMsgEvent",buf,len,true))) return 0;
00029   len-=used; buf+=used;
00030   if(0==(used=decode(_text,buf,len))) return 0;
00031   len-=used; buf+=used;
00032   //if(0==(used=decode(_token,buf,len))) return 0;
00033   //len-=used; buf+=used;
00034   return origlen-len; 
00035 }
00036 
00037 unsigned int
00038 TextMsgEvent::SaveBuffer(char buf[], unsigned int len) const {
00039   unsigned int origlen=len;
00040   unsigned int used;
00041   if(0==(used=EventBase::SaveBuffer(buf,len))) return 0;
00042   len-=used; buf+=used;
00043   if(0==(used=saveCreator("EventBase::TextMsgEvent",buf,len))) return 0;
00044   len-=used; buf+=used;
00045   if(0==(used=encode(_text,buf,len))) return 0;
00046   len-=used; buf+=used;
00047   //if(0==(used=encode(_token,buf,len))) return 0;
00048   //len-=used; buf+=used;
00049   return origlen-len;
00050 }
00051 
00052 /*! @file
00053  * @brief Implements TextMsgEvent, which extends EventBase to also include actual message text
00054  * @author ejt (Creator)
00055  *
00056  * $Author: ejt $
00057  * $Name: tekkotsu-2_2 $
00058  * $Revision: 1.1 $
00059  * $State: Exp $
00060  * $Date: 2004/09/01 21:30:57 $
00061  */

Tekkotsu v2.2
Generated Tue Oct 19 14:19:16 2004 by Doxygen 1.3.9.1