Bytes.h
Go to the documentation of this file.
00001 #ifndef _ROS_rtabmap_Bytes_h
00002 #define _ROS_rtabmap_Bytes_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace rtabmap
00010 {
00011 
00012   class Bytes : public ros::Msg
00013   {
00014     public:
00015       uint8_t bytes_length;
00016       uint8_t st_bytes;
00017       uint8_t * bytes;
00018 
00019     virtual int serialize(unsigned char *outbuffer) const
00020     {
00021       int offset = 0;
00022       *(outbuffer + offset++) = bytes_length;
00023       *(outbuffer + offset++) = 0;
00024       *(outbuffer + offset++) = 0;
00025       *(outbuffer + offset++) = 0;
00026       for( uint8_t i = 0; i < bytes_length; i++){
00027       *(outbuffer + offset + 0) = (this->bytes[i] >> (8 * 0)) & 0xFF;
00028       offset += sizeof(this->bytes[i]);
00029       }
00030       return offset;
00031     }
00032 
00033     virtual int deserialize(unsigned char *inbuffer)
00034     {
00035       int offset = 0;
00036       uint8_t bytes_lengthT = *(inbuffer + offset++);
00037       if(bytes_lengthT > bytes_length)
00038         this->bytes = (uint8_t*)realloc(this->bytes, bytes_lengthT * sizeof(uint8_t));
00039       offset += 3;
00040       bytes_length = bytes_lengthT;
00041       for( uint8_t i = 0; i < bytes_length; i++){
00042       this->st_bytes =  ((uint8_t) (*(inbuffer + offset)));
00043       offset += sizeof(this->st_bytes);
00044         memcpy( &(this->bytes[i]), &(this->st_bytes), sizeof(uint8_t));
00045       }
00046      return offset;
00047     }
00048 
00049     const char * getType(){ return "rtabmap/Bytes"; };
00050     const char * getMD5(){ return "d159f2bd8169d3b3339e6f1fce045c6d"; };
00051 
00052   };
00053 
00054 }
00055 #endif


ric_mc
Author(s): RoboTiCan
autogenerated on Fri May 20 2016 03:48:55