Homepage Demos Overview Downloads Tutorials Reference
Credits

LocomotionEvent.cc

Go to the documentation of this file.
00001 #include "LocomotionEvent.h"
00002 #include <sstream>
00003 
00004 std::string
00005 LocomotionEvent::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' << x << '\t' << y << '\t' << a;
00010   return logdata.str();
00011 }
00012   
00013 unsigned int
00014 LocomotionEvent::getBinSize() const {
00015   unsigned int used=EventBase::getBinSize();
00016   used+=creatorSize("EventBase::LocomotionEvent");
00017   used+=sizeof(x);
00018   used+=sizeof(y);
00019   used+=sizeof(a);
00020   return used;
00021 }
00022 
00023 unsigned int
00024 LocomotionEvent::LoadBuffer(const char buf[], unsigned int len) {
00025   unsigned int origlen=len;
00026   unsigned int used;
00027   if(0==(used=EventBase::LoadBuffer(buf,len))) return 0;
00028   len-=used; buf+=used;
00029   if(0==(used=checkCreator("EventBase::LocomotionEvent",buf,len,true))) return 0;
00030   len-=used; buf+=used;
00031   if(0==(used=decode(x,buf,len))) return 0;
00032   len-=used; buf+=used;
00033   if(0==(used=decode(y,buf,len))) return 0;
00034   len-=used; buf+=used;
00035   if(0==(used=decode(a,buf,len))) return 0;
00036   len-=used; buf+=used;
00037   return origlen-len; 
00038 }
00039 
00040 unsigned int
00041 LocomotionEvent::SaveBuffer(char buf[], unsigned int len) const {
00042   unsigned int origlen=len;
00043   unsigned int used;
00044   if(0==(used=EventBase::SaveBuffer(buf,len))) return 0;
00045   len-=used; buf+=used;
00046   if(0==(used=saveCreator("EventBase::LocomotionEvent",buf,len))) return 0;
00047   len-=used; buf+=used;
00048   if(0==(used=encode(x,buf,len))) return 0;
00049   len-=used; buf+=used;
00050   if(0==(used=encode(y,buf,len))) return 0;
00051   len-=used; buf+=used;
00052   if(0==(used=encode(a,buf,len))) return 0;
00053   len-=used; buf+=used;
00054   return origlen-len;
00055 }
00056 
00057 
00058 /*! @file
00059  * @brief Implements LocomotionEvent, which gives updates regarding the current movement of the robot through the world
00060  * @author ejt (Creator)
00061  *
00062  * $Author: ejt $
00063  * $Name: tekkotsu-2_2 $
00064  * $Revision: 1.1 $
00065  * $State: Exp $
00066  * $Date: 2004/09/01 21:30:57 $
00067  */

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