kitt_platform
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros
Polygon.h
Go to the documentation of this file.
1 #ifndef _ROS_geometry_msgs_Polygon_h
2 #define _ROS_geometry_msgs_Polygon_h
3 
4 #include <stdint.h>
5 #include <string.h>
6 #include <stdlib.h>
7 #include "ros/msg.h"
9 
10 namespace geometry_msgs
11 {
12 
13  class Polygon : public ros::Msg
14  {
15  public:
16  uint8_t points_length;
19 
21  points_length(0), points(NULL)
22  {
23  }
24 
25  virtual int serialize(unsigned char *outbuffer) const
26  {
27  int offset = 0;
28  *(outbuffer + offset++) = points_length;
29  *(outbuffer + offset++) = 0;
30  *(outbuffer + offset++) = 0;
31  *(outbuffer + offset++) = 0;
32  for( uint8_t i = 0; i < points_length; i++){
33  offset += this->points[i].serialize(outbuffer + offset);
34  }
35  return offset;
36  }
37 
38  virtual int deserialize(unsigned char *inbuffer)
39  {
40  int offset = 0;
41  uint8_t points_lengthT = *(inbuffer + offset++);
42  if(points_lengthT > points_length)
43  this->points = (geometry_msgs::Point32*)realloc(this->points, points_lengthT * sizeof(geometry_msgs::Point32));
44  offset += 3;
45  points_length = points_lengthT;
46  for( uint8_t i = 0; i < points_length; i++){
47  offset += this->st_points.deserialize(inbuffer + offset);
48  memcpy( &(this->points[i]), &(this->st_points), sizeof(geometry_msgs::Point32));
49  }
50  return offset;
51  }
52 
53  const char * getType(){ return "geometry_msgs/Polygon"; };
54  const char * getMD5(){ return "cd60a26494a087f577976f0329fa120e"; };
55 
56  };
57 
58 }
59 #endif
geometry_msgs::Point32 * points
Definition: Polygon.h:18
virtual int deserialize(unsigned char *inbuffer)
Definition: Polygon.h:38
virtual int serialize(unsigned char *outbuffer) const
Definition: Polygon.h:25
Definition: Polygon.h:13
const char * getType()
Definition: Polygon.h:53
virtual int serialize(unsigned char *outbuffer) const
Definition: Point32.h:26
virtual int deserialize(unsigned char *inbuffer)
Definition: Point32.h:62
Polygon()
Definition: Polygon.h:20
Definition: Point32.h:12
const char * getMD5()
Definition: Polygon.h:54
uint8_t points_length
Definition: Polygon.h:16
geometry_msgs::Point32 st_points
Definition: Polygon.h:17
Definition: msg.h:43