PointField.h
Go to the documentation of this file.
00001 #ifndef _ROS_sensor_msgs_PointField_h
00002 #define _ROS_sensor_msgs_PointField_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace sensor_msgs
00010 {
00011 
00012   class PointField : public ros::Msg
00013   {
00014     public:
00015       const char* name;
00016       uint32_t offset;
00017       uint8_t datatype;
00018       uint32_t count;
00019       enum { INT8 =  1 };
00020       enum { UINT8 =  2 };
00021       enum { INT16 =  3 };
00022       enum { UINT16 =  4 };
00023       enum { INT32 =  5 };
00024       enum { UINT32 =  6 };
00025       enum { FLOAT32 =  7 };
00026       enum { FLOAT64 =  8 };
00027 
00028     virtual int serialize(unsigned char *outbuffer) const
00029     {
00030       int offset = 0;
00031       uint32_t length_name = strlen(this->name);
00032       memcpy(outbuffer + offset, &length_name, sizeof(uint32_t));
00033       offset += 4;
00034       memcpy(outbuffer + offset, this->name, length_name);
00035       offset += length_name;
00036       *(outbuffer + offset + 0) = (this->offset >> (8 * 0)) & 0xFF;
00037       *(outbuffer + offset + 1) = (this->offset >> (8 * 1)) & 0xFF;
00038       *(outbuffer + offset + 2) = (this->offset >> (8 * 2)) & 0xFF;
00039       *(outbuffer + offset + 3) = (this->offset >> (8 * 3)) & 0xFF;
00040       offset += sizeof(this->offset);
00041       *(outbuffer + offset + 0) = (this->datatype >> (8 * 0)) & 0xFF;
00042       offset += sizeof(this->datatype);
00043       *(outbuffer + offset + 0) = (this->count >> (8 * 0)) & 0xFF;
00044       *(outbuffer + offset + 1) = (this->count >> (8 * 1)) & 0xFF;
00045       *(outbuffer + offset + 2) = (this->count >> (8 * 2)) & 0xFF;
00046       *(outbuffer + offset + 3) = (this->count >> (8 * 3)) & 0xFF;
00047       offset += sizeof(this->count);
00048       return offset;
00049     }
00050 
00051     virtual int deserialize(unsigned char *inbuffer)
00052     {
00053       int offset = 0;
00054       uint32_t length_name;
00055       memcpy(&length_name, (inbuffer + offset), sizeof(uint32_t));
00056       offset += 4;
00057       for(unsigned int k= offset; k< offset+length_name; ++k){
00058           inbuffer[k-1]=inbuffer[k];
00059       }
00060       inbuffer[offset+length_name-1]=0;
00061       this->name = (char *)(inbuffer + offset-1);
00062       offset += length_name;
00063       this->offset =  ((uint32_t) (*(inbuffer + offset)));
00064       this->offset |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00065       this->offset |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00066       this->offset |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00067       offset += sizeof(this->offset);
00068       this->datatype =  ((uint8_t) (*(inbuffer + offset)));
00069       offset += sizeof(this->datatype);
00070       this->count =  ((uint32_t) (*(inbuffer + offset)));
00071       this->count |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00072       this->count |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00073       this->count |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00074       offset += sizeof(this->count);
00075      return offset;
00076     }
00077 
00078     const char * getType(){ return "sensor_msgs/PointField"; };
00079     const char * getMD5(){ return "268eacb2962780ceac86cbd17e328150"; };
00080 
00081   };
00082 
00083 }
00084 #endif


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