kitt_platform
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros
PointCloud.h
Go to the documentation of this file.
1 #ifndef _ROS_sensor_msgs_PointCloud_h
2 #define _ROS_sensor_msgs_PointCloud_h
3 
4 #include <stdint.h>
5 #include <string.h>
6 #include <stdlib.h>
7 #include "ros/msg.h"
8 #include "std_msgs/Header.h"
11 
12 namespace sensor_msgs
13 {
14 
15  class PointCloud : public ros::Msg
16  {
17  public:
19  uint8_t points_length;
22  uint8_t channels_length;
25 
27  header(),
28  points_length(0), points(NULL),
29  channels_length(0), channels(NULL)
30  {
31  }
32 
33  virtual int serialize(unsigned char *outbuffer) const
34  {
35  int offset = 0;
36  offset += this->header.serialize(outbuffer + offset);
37  *(outbuffer + offset++) = points_length;
38  *(outbuffer + offset++) = 0;
39  *(outbuffer + offset++) = 0;
40  *(outbuffer + offset++) = 0;
41  for( uint8_t i = 0; i < points_length; i++){
42  offset += this->points[i].serialize(outbuffer + offset);
43  }
44  *(outbuffer + offset++) = channels_length;
45  *(outbuffer + offset++) = 0;
46  *(outbuffer + offset++) = 0;
47  *(outbuffer + offset++) = 0;
48  for( uint8_t i = 0; i < channels_length; i++){
49  offset += this->channels[i].serialize(outbuffer + offset);
50  }
51  return offset;
52  }
53 
54  virtual int deserialize(unsigned char *inbuffer)
55  {
56  int offset = 0;
57  offset += this->header.deserialize(inbuffer + offset);
58  uint8_t points_lengthT = *(inbuffer + offset++);
59  if(points_lengthT > points_length)
60  this->points = (geometry_msgs::Point32*)realloc(this->points, points_lengthT * sizeof(geometry_msgs::Point32));
61  offset += 3;
62  points_length = points_lengthT;
63  for( uint8_t i = 0; i < points_length; i++){
64  offset += this->st_points.deserialize(inbuffer + offset);
65  memcpy( &(this->points[i]), &(this->st_points), sizeof(geometry_msgs::Point32));
66  }
67  uint8_t channels_lengthT = *(inbuffer + offset++);
68  if(channels_lengthT > channels_length)
69  this->channels = (sensor_msgs::ChannelFloat32*)realloc(this->channels, channels_lengthT * sizeof(sensor_msgs::ChannelFloat32));
70  offset += 3;
71  channels_length = channels_lengthT;
72  for( uint8_t i = 0; i < channels_length; i++){
73  offset += this->st_channels.deserialize(inbuffer + offset);
74  memcpy( &(this->channels[i]), &(this->st_channels), sizeof(sensor_msgs::ChannelFloat32));
75  }
76  return offset;
77  }
78 
79  const char * getType(){ return "sensor_msgs/PointCloud"; };
80  const char * getMD5(){ return "d8e9c3f5afbdd8a130fd1d2763945fca"; };
81 
82  };
83 
84 }
85 #endif
geometry_msgs::Point32 st_points
Definition: PointCloud.h:20
virtual int deserialize(unsigned char *inbuffer)
Definition: Header.h:53
sensor_msgs::ChannelFloat32 st_channels
Definition: PointCloud.h:23
sensor_msgs::ChannelFloat32 * channels
Definition: PointCloud.h:24
geometry_msgs::Point32 * points
Definition: PointCloud.h:21
virtual int serialize(unsigned char *outbuffer) const
Definition: Point32.h:26
virtual int serialize(unsigned char *outbuffer) const
Definition: ChannelFloat32.h:26
virtual int serialize(unsigned char *outbuffer) const
Definition: Header.h:27
virtual int deserialize(unsigned char *inbuffer)
Definition: Point32.h:62
uint8_t channels_length
Definition: PointCloud.h:22
Definition: Point32.h:12
std_msgs::Header header
Definition: PointCloud.h:18
virtual int deserialize(unsigned char *inbuffer)
Definition: ChannelFloat32.h:53
Definition: Header.h:13
virtual int deserialize(unsigned char *inbuffer)
Definition: PointCloud.h:54
const char * getType()
Definition: PointCloud.h:79
uint8_t points_length
Definition: PointCloud.h:19
const char * getMD5()
Definition: PointCloud.h:80
virtual int serialize(unsigned char *outbuffer) const
Definition: PointCloud.h:33
Definition: PointCloud.h:15
PointCloud()
Definition: PointCloud.h:26
Definition: msg.h:43
Definition: ChannelFloat32.h:12