Working towards recieving twists

Dependencies:   BufferedSerial

Fork of ros_lib_kinetic by Gary Servin

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers PointIndices.h Source File

PointIndices.h

00001 #ifndef _ROS_pcl_msgs_PointIndices_h
00002 #define _ROS_pcl_msgs_PointIndices_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "std_msgs/Header.h"
00009 
00010 namespace pcl_msgs
00011 {
00012 
00013   class PointIndices : public ros::Msg
00014   {
00015     public:
00016       typedef std_msgs::Header _header_type;
00017       _header_type header;
00018       uint32_t indices_length;
00019       typedef int32_t _indices_type;
00020       _indices_type st_indices;
00021       _indices_type * indices;
00022 
00023     PointIndices():
00024       header(),
00025       indices_length(0), indices(NULL)
00026     {
00027     }
00028 
00029     virtual int serialize(unsigned char *outbuffer) const
00030     {
00031       int offset = 0;
00032       offset += this->header.serialize(outbuffer + offset);
00033       *(outbuffer + offset + 0) = (this->indices_length >> (8 * 0)) & 0xFF;
00034       *(outbuffer + offset + 1) = (this->indices_length >> (8 * 1)) & 0xFF;
00035       *(outbuffer + offset + 2) = (this->indices_length >> (8 * 2)) & 0xFF;
00036       *(outbuffer + offset + 3) = (this->indices_length >> (8 * 3)) & 0xFF;
00037       offset += sizeof(this->indices_length);
00038       for( uint32_t i = 0; i < indices_length; i++){
00039       union {
00040         int32_t real;
00041         uint32_t base;
00042       } u_indicesi;
00043       u_indicesi.real = this->indices[i];
00044       *(outbuffer + offset + 0) = (u_indicesi.base >> (8 * 0)) & 0xFF;
00045       *(outbuffer + offset + 1) = (u_indicesi.base >> (8 * 1)) & 0xFF;
00046       *(outbuffer + offset + 2) = (u_indicesi.base >> (8 * 2)) & 0xFF;
00047       *(outbuffer + offset + 3) = (u_indicesi.base >> (8 * 3)) & 0xFF;
00048       offset += sizeof(this->indices[i]);
00049       }
00050       return offset;
00051     }
00052 
00053     virtual int deserialize(unsigned char *inbuffer)
00054     {
00055       int offset = 0;
00056       offset += this->header.deserialize(inbuffer + offset);
00057       uint32_t indices_lengthT = ((uint32_t) (*(inbuffer + offset))); 
00058       indices_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 
00059       indices_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 
00060       indices_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 
00061       offset += sizeof(this->indices_length);
00062       if(indices_lengthT > indices_length)
00063         this->indices = (int32_t*)realloc(this->indices, indices_lengthT * sizeof(int32_t));
00064       indices_length = indices_lengthT;
00065       for( uint32_t i = 0; i < indices_length; i++){
00066       union {
00067         int32_t real;
00068         uint32_t base;
00069       } u_st_indices;
00070       u_st_indices.base = 0;
00071       u_st_indices.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00072       u_st_indices.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00073       u_st_indices.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00074       u_st_indices.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00075       this->st_indices = u_st_indices.real;
00076       offset += sizeof(this->st_indices);
00077         memcpy( &(this->indices[i]), &(this->st_indices), sizeof(int32_t));
00078       }
00079      return offset;
00080     }
00081 
00082     const char * getType(){ return "pcl_msgs/PointIndices"; };
00083     const char * getMD5(){ return "458c7998b7eaf99908256472e273b3d4"; };
00084 
00085   };
00086 
00087 }
00088 #endif