rosserial for Hydro
Fork of rosserial_mbed_lib by
Diff: geometry_msgs/Polygon.h
- Revision:
- 1:ff0ec969dad1
- Parent:
- 0:77afd7560544
- Child:
- 3:1cf99502f396
--- a/geometry_msgs/Polygon.h Fri Aug 19 09:06:30 2011 +0000 +++ b/geometry_msgs/Polygon.h Sun Oct 16 07:19:36 2011 +0000 @@ -1,5 +1,5 @@ -#ifndef ros_Polygon_h -#define ros_Polygon_h +#ifndef ros_geometry_msgs_Polygon_h +#define ros_geometry_msgs_Polygon_h #include <stdint.h> #include <string.h> @@ -7,47 +7,45 @@ #include "../ros/msg.h" #include "geometry_msgs/Point32.h" -namespace geometry_msgs -{ +namespace geometry_msgs { - class Polygon : public ros::Msg - { - public: - unsigned char points_length; - geometry_msgs::Point32 st_points; - geometry_msgs::Point32 * points; +class Polygon : public ros::Msg { +public: + unsigned char points_length; + geometry_msgs::Point32 st_points; + geometry_msgs::Point32 * points; - virtual int serialize(unsigned char *outbuffer) - { - int offset = 0; - *(outbuffer + offset++) = points_length; - *(outbuffer + offset++) = 0; - *(outbuffer + offset++) = 0; - *(outbuffer + offset++) = 0; - for( unsigned char i = 0; i < points_length; i++){ - offset += this->points[i].serialize(outbuffer + offset); - } - return offset; + virtual int serialize(unsigned char *outbuffer) { + int offset = 0; + *(outbuffer + offset++) = points_length; + *(outbuffer + offset++) = 0; + *(outbuffer + offset++) = 0; + *(outbuffer + offset++) = 0; + for ( unsigned char i = 0; i < points_length; i++) { + offset += this->points[i].serialize(outbuffer + offset); + } + return offset; } - virtual int deserialize(unsigned char *inbuffer) - { - int offset = 0; - unsigned char points_lengthT = *(inbuffer + offset++); - if(points_lengthT > points_length) - this->points = (geometry_msgs::Point32*)realloc(this->points, points_lengthT * sizeof(geometry_msgs::Point32)); - offset += 3; - points_length = points_lengthT; - for( unsigned char 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; + virtual int deserialize(unsigned char *inbuffer) { + int offset = 0; + unsigned char points_lengthT = *(inbuffer + offset++); + if (points_lengthT > points_length) + this->points = (geometry_msgs::Point32*)realloc(this->points, points_lengthT * sizeof(geometry_msgs::Point32)); + offset += 3; + points_length = points_lengthT; + for ( unsigned char 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; } - virtual const char * getType(){ return "geometry_msgs/Polygon"; }; + virtual const char * getType() { + return "geometry_msgs/Polygon"; + }; - }; +}; } #endif \ No newline at end of file