Working towards recieving twists
Fork of ros_lib_kinetic by
Embed:
(wiki syntax)
Show/hide line numbers
Mesh.h
00001 #ifndef _ROS_shape_msgs_Mesh_h 00002 #define _ROS_shape_msgs_Mesh_h 00003 00004 #include <stdint.h> 00005 #include <string.h> 00006 #include <stdlib.h> 00007 #include "ros/msg.h" 00008 #include "shape_msgs/MeshTriangle.h" 00009 #include "geometry_msgs/Point.h" 00010 00011 namespace shape_msgs 00012 { 00013 00014 class Mesh : public ros::Msg 00015 { 00016 public: 00017 uint32_t triangles_length; 00018 typedef shape_msgs::MeshTriangle _triangles_type; 00019 _triangles_type st_triangles; 00020 _triangles_type * triangles; 00021 uint32_t vertices_length; 00022 typedef geometry_msgs::Point _vertices_type; 00023 _vertices_type st_vertices; 00024 _vertices_type * vertices; 00025 00026 Mesh(): 00027 triangles_length(0), triangles(NULL), 00028 vertices_length(0), vertices(NULL) 00029 { 00030 } 00031 00032 virtual int serialize(unsigned char *outbuffer) const 00033 { 00034 int offset = 0; 00035 *(outbuffer + offset + 0) = (this->triangles_length >> (8 * 0)) & 0xFF; 00036 *(outbuffer + offset + 1) = (this->triangles_length >> (8 * 1)) & 0xFF; 00037 *(outbuffer + offset + 2) = (this->triangles_length >> (8 * 2)) & 0xFF; 00038 *(outbuffer + offset + 3) = (this->triangles_length >> (8 * 3)) & 0xFF; 00039 offset += sizeof(this->triangles_length); 00040 for( uint32_t i = 0; i < triangles_length; i++){ 00041 offset += this->triangles[i].serialize(outbuffer + offset); 00042 } 00043 *(outbuffer + offset + 0) = (this->vertices_length >> (8 * 0)) & 0xFF; 00044 *(outbuffer + offset + 1) = (this->vertices_length >> (8 * 1)) & 0xFF; 00045 *(outbuffer + offset + 2) = (this->vertices_length >> (8 * 2)) & 0xFF; 00046 *(outbuffer + offset + 3) = (this->vertices_length >> (8 * 3)) & 0xFF; 00047 offset += sizeof(this->vertices_length); 00048 for( uint32_t i = 0; i < vertices_length; i++){ 00049 offset += this->vertices[i].serialize(outbuffer + offset); 00050 } 00051 return offset; 00052 } 00053 00054 virtual int deserialize(unsigned char *inbuffer) 00055 { 00056 int offset = 0; 00057 uint32_t triangles_lengthT = ((uint32_t) (*(inbuffer + offset))); 00058 triangles_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00059 triangles_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00060 triangles_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00061 offset += sizeof(this->triangles_length); 00062 if(triangles_lengthT > triangles_length) 00063 this->triangles = (shape_msgs::MeshTriangle*)realloc(this->triangles, triangles_lengthT * sizeof(shape_msgs::MeshTriangle)); 00064 triangles_length = triangles_lengthT; 00065 for( uint32_t i = 0; i < triangles_length; i++){ 00066 offset += this->st_triangles.deserialize(inbuffer + offset); 00067 memcpy( &(this->triangles[i]), &(this->st_triangles), sizeof(shape_msgs::MeshTriangle)); 00068 } 00069 uint32_t vertices_lengthT = ((uint32_t) (*(inbuffer + offset))); 00070 vertices_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00071 vertices_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00072 vertices_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00073 offset += sizeof(this->vertices_length); 00074 if(vertices_lengthT > vertices_length) 00075 this->vertices = (geometry_msgs::Point*)realloc(this->vertices, vertices_lengthT * sizeof(geometry_msgs::Point)); 00076 vertices_length = vertices_lengthT; 00077 for( uint32_t i = 0; i < vertices_length; i++){ 00078 offset += this->st_vertices.deserialize(inbuffer + offset); 00079 memcpy( &(this->vertices[i]), &(this->st_vertices), sizeof(geometry_msgs::Point)); 00080 } 00081 return offset; 00082 } 00083 00084 const char * getType(){ return "shape_msgs/Mesh"; }; 00085 const char * getMD5(){ return "1ffdae9486cd3316a121c578b47a85cc"; }; 00086 00087 }; 00088 00089 } 00090 #endif
Generated on Tue Jul 12 2022 21:32:16 by 1.7.2