ROS Serial library for Mbed platforms for ROS Kinetic Kame. Check http://wiki.ros.org/rosserial_mbed/ for more information.
Diff: geometry_msgs/Polygon.h
- Revision:
- 0:9e9b7db60fd5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geometry_msgs/Polygon.h Sat Dec 31 00:48:34 2016 +0000 @@ -0,0 +1,64 @@ +#ifndef _ROS_geometry_msgs_Polygon_h +#define _ROS_geometry_msgs_Polygon_h + +#include <stdint.h> +#include <string.h> +#include <stdlib.h> +#include "ros/msg.h" +#include "geometry_msgs/Point32.h" + +namespace geometry_msgs +{ + + class Polygon : public ros::Msg + { + public: + uint32_t points_length; + typedef geometry_msgs::Point32 _points_type; + _points_type st_points; + _points_type * points; + + Polygon(): + points_length(0), points(NULL) + { + } + + virtual int serialize(unsigned char *outbuffer) const + { + int offset = 0; + *(outbuffer + offset + 0) = (this->points_length >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (this->points_length >> (8 * 1)) & 0xFF; + *(outbuffer + offset + 2) = (this->points_length >> (8 * 2)) & 0xFF; + *(outbuffer + offset + 3) = (this->points_length >> (8 * 3)) & 0xFF; + offset += sizeof(this->points_length); + for( uint32_t i = 0; i < points_length; i++){ + offset += this->points[i].serialize(outbuffer + offset); + } + return offset; + } + + virtual int deserialize(unsigned char *inbuffer) + { + int offset = 0; + uint32_t points_lengthT = ((uint32_t) (*(inbuffer + offset))); + points_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); + points_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); + points_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); + offset += sizeof(this->points_length); + if(points_lengthT > points_length) + this->points = (geometry_msgs::Point32*)realloc(this->points, points_lengthT * sizeof(geometry_msgs::Point32)); + points_length = points_lengthT; + for( uint32_t i = 0; i < points_length; i++){ + offset += this->st_points.deserialize(inbuffer + offset); + memcpy( &(this->points[i]), &(this->st_points), sizeof(geometry_msgs::Point32)); + } + return offset; + } + + const char * getType(){ return "geometry_msgs/Polygon"; }; + const char * getMD5(){ return "cd60a26494a087f577976f0329fa120e"; }; + + }; + +} +#endif \ No newline at end of file