Mesh.h
Go to the documentation of this file.
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       uint8_t triangles_length;
00018       shape_msgs::MeshTriangle st_triangles;
00019       shape_msgs::MeshTriangle * triangles;
00020       uint8_t vertices_length;
00021       geometry_msgs::Point st_vertices;
00022       geometry_msgs::Point * vertices;
00023 
00024     virtual int serialize(unsigned char *outbuffer) const
00025     {
00026       int offset = 0;
00027       *(outbuffer + offset++) = triangles_length;
00028       *(outbuffer + offset++) = 0;
00029       *(outbuffer + offset++) = 0;
00030       *(outbuffer + offset++) = 0;
00031       for( uint8_t i = 0; i < triangles_length; i++){
00032       offset += this->triangles[i].serialize(outbuffer + offset);
00033       }
00034       *(outbuffer + offset++) = vertices_length;
00035       *(outbuffer + offset++) = 0;
00036       *(outbuffer + offset++) = 0;
00037       *(outbuffer + offset++) = 0;
00038       for( uint8_t i = 0; i < vertices_length; i++){
00039       offset += this->vertices[i].serialize(outbuffer + offset);
00040       }
00041       return offset;
00042     }
00043 
00044     virtual int deserialize(unsigned char *inbuffer)
00045     {
00046       int offset = 0;
00047       uint8_t triangles_lengthT = *(inbuffer + offset++);
00048       if(triangles_lengthT > triangles_length)
00049         this->triangles = (shape_msgs::MeshTriangle*)realloc(this->triangles, triangles_lengthT * sizeof(shape_msgs::MeshTriangle));
00050       offset += 3;
00051       triangles_length = triangles_lengthT;
00052       for( uint8_t i = 0; i < triangles_length; i++){
00053       offset += this->st_triangles.deserialize(inbuffer + offset);
00054         memcpy( &(this->triangles[i]), &(this->st_triangles), sizeof(shape_msgs::MeshTriangle));
00055       }
00056       uint8_t vertices_lengthT = *(inbuffer + offset++);
00057       if(vertices_lengthT > vertices_length)
00058         this->vertices = (geometry_msgs::Point*)realloc(this->vertices, vertices_lengthT * sizeof(geometry_msgs::Point));
00059       offset += 3;
00060       vertices_length = vertices_lengthT;
00061       for( uint8_t i = 0; i < vertices_length; i++){
00062       offset += this->st_vertices.deserialize(inbuffer + offset);
00063         memcpy( &(this->vertices[i]), &(this->st_vertices), sizeof(geometry_msgs::Point));
00064       }
00065      return offset;
00066     }
00067 
00068     const char * getType(){ return "shape_msgs/Mesh"; };
00069     const char * getMD5(){ return "1ffdae9486cd3316a121c578b47a85cc"; };
00070 
00071   };
00072 
00073 }
00074 #endif


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