00001 #ifndef _ROS_pcl_msgs_PolygonMesh_h 00002 #define _ROS_pcl_msgs_PolygonMesh_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 #include "sensor_msgs/PointCloud2.h" 00010 #include "pcl_msgs/Vertices.h" 00011 00012 namespace pcl_msgs 00013 { 00014 00015 class PolygonMesh : public ros::Msg 00016 { 00017 public: 00018 std_msgs::Header header; 00019 sensor_msgs::PointCloud2 cloud; 00020 uint8_t polygons_length; 00021 pcl_msgs::Vertices st_polygons; 00022 pcl_msgs::Vertices * polygons; 00023 00024 virtual int serialize(unsigned char *outbuffer) const 00025 { 00026 int offset = 0; 00027 offset += this->header.serialize(outbuffer + offset); 00028 offset += this->cloud.serialize(outbuffer + offset); 00029 *(outbuffer + offset++) = polygons_length; 00030 *(outbuffer + offset++) = 0; 00031 *(outbuffer + offset++) = 0; 00032 *(outbuffer + offset++) = 0; 00033 for( uint8_t i = 0; i < polygons_length; i++){ 00034 offset += this->polygons[i].serialize(outbuffer + offset); 00035 } 00036 return offset; 00037 } 00038 00039 virtual int deserialize(unsigned char *inbuffer) 00040 { 00041 int offset = 0; 00042 offset += this->header.deserialize(inbuffer + offset); 00043 offset += this->cloud.deserialize(inbuffer + offset); 00044 uint8_t polygons_lengthT = *(inbuffer + offset++); 00045 if(polygons_lengthT > polygons_length) 00046 this->polygons = (pcl_msgs::Vertices*)realloc(this->polygons, polygons_lengthT * sizeof(pcl_msgs::Vertices)); 00047 offset += 3; 00048 polygons_length = polygons_lengthT; 00049 for( uint8_t i = 0; i < polygons_length; i++){ 00050 offset += this->st_polygons.deserialize(inbuffer + offset); 00051 memcpy( &(this->polygons[i]), &(this->st_polygons), sizeof(pcl_msgs::Vertices)); 00052 } 00053 return offset; 00054 } 00055 00056 const char * getType(){ return "pcl_msgs/PolygonMesh"; }; 00057 const char * getMD5(){ return "45a5fc6ad2cde8489600a790acc9a38a"; }; 00058 00059 }; 00060 00061 } 00062 #endif