Homepage
Demos
Overview
Downloads
Tutorials
Reference
Credits

VisionObjectEvent.cc

Go to the documentation of this file.
00001 #include "VisionObjectEvent.h"
00002 #include <sstream>
00003 
00004 // Changed 'getDescription' to show BB and area info in EventLogger. Change functions to add new parameters (BB and area) to buffer
00005 
00006 std::string
00007 VisionObjectEvent::getDescription(bool showTypeSpecific/*=true*/, unsigned int verbosity/*=0*/) const {
00008   if(!showTypeSpecific)
00009     return EventBase::getDescription(showTypeSpecific,verbosity);
00010   std::ostringstream logdata;
00011   logdata << EventBase::getDescription(showTypeSpecific,verbosity) << '\t' << _x1 <<  '\t' <<_x2 <<'\t' <<_y1 <<'\t' <<_y2 ;
00012   return logdata.str();
00013 }
00014 
00015 unsigned int
00016 VisionObjectEvent::getBinSize() const {
00017   unsigned int used=EventBase::getBinSize();
00018   used+=creatorSize("EventBase::VisionObjectEvent");
00019   used+=sizeof(_x1);
00020   used+=sizeof(_x2);
00021   used+=sizeof(_y1);
00022   used+=sizeof(_y2);
00023   return used;
00024 }
00025 
00026 unsigned int
00027 VisionObjectEvent::LoadBuffer(const char buf[], unsigned int len) {
00028   unsigned int origlen=len;
00029   unsigned int used;
00030   if(0==(used=EventBase::LoadBuffer(buf,len))) return 0;
00031   len-=used; buf+=used;
00032   if(0==(used=checkCreator("EventBase::VisionObjectEvent",buf,len,true))) return 0;
00033   len-=used; buf+=used;
00034   if(0==(used=decode(_x1,buf,len))) return 0;
00035   len-=used; buf+=used; 
00036   if(0==(used=decode(_x2,buf,len))) return 0;
00037   len-=used; buf+=used; 
00038   if(0==(used=decode(_y1,buf,len))) return 0;
00039   len-=used; buf+=used; 
00040   if(0==(used=decode(_y2,buf,len))) return 0;
00041   len-=used; buf+=used; 
00042   return origlen-len; 
00043 }
00044 
00045 unsigned int
00046 VisionObjectEvent::SaveBuffer(char buf[], unsigned int len) const {
00047   unsigned int origlen=len;
00048   unsigned int used;
00049   if(0==(used=EventBase::SaveBuffer(buf,len))) return 0;
00050   len-=used; buf+=used;
00051   if(0==(used=saveCreator("EventBase::VisionObjectEvent",buf,len))) return 0;
00052   len-=used; buf+=used;
00053   if(0==(used=encode(_x1,buf,len))) return 0;
00054   len-=used; buf+=used; 
00055   if(0==(used=encode(_x2,buf,len))) return 0;
00056   len-=used; buf+=used; 
00057   if(0==(used=encode(_y1,buf,len))) return 0;
00058   len-=used; buf+=used; 
00059   if(0==(used=encode(_y2,buf,len))) return 0;
00060   len-=used; buf+=used; 
00061   return origlen-len;
00062 }
00063 
00064 /*! @file
00065  * @brief Implements VisionObjectEvent, which provides information about objects recognized in the camera image
00066  * @author alokl (Creator)
00067  * @author Ignacio Herrero Reder <nhr at dte uma es> (VisionObjectInfo Boundary Box - bug 74)
00068  *
00069  * $Author: ejt $
00070  * $Name: tekkotsu-2_3 $
00071  * $Revision: 1.5 $
00072  * $State: Exp $
00073  * $Date: 2005/01/12 21:48:17 $
00074  */

Tekkotsu v2.3
Generated Sat Jan 29 02:25:24 2005 by Doxygen 1.4.0