kitt_platform
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros
MultiArrayLayout.h
Go to the documentation of this file.
1 #ifndef _ROS_std_msgs_MultiArrayLayout_h
2 #define _ROS_std_msgs_MultiArrayLayout_h
3 
4 #include <stdint.h>
5 #include <string.h>
6 #include <stdlib.h>
7 #include "ros/msg.h"
9 
10 namespace std_msgs
11 {
12 
13  class MultiArrayLayout : public ros::Msg
14  {
15  public:
16  uint8_t dim_length;
19  uint32_t data_offset;
20 
22  dim_length(0), dim(NULL),
23  data_offset(0)
24  {
25  }
26 
27  virtual int serialize(unsigned char *outbuffer) const
28  {
29  int offset = 0;
30  *(outbuffer + offset++) = dim_length;
31  *(outbuffer + offset++) = 0;
32  *(outbuffer + offset++) = 0;
33  *(outbuffer + offset++) = 0;
34  for( uint8_t i = 0; i < dim_length; i++){
35  offset += this->dim[i].serialize(outbuffer + offset);
36  }
37  *(outbuffer + offset + 0) = (this->data_offset >> (8 * 0)) & 0xFF;
38  *(outbuffer + offset + 1) = (this->data_offset >> (8 * 1)) & 0xFF;
39  *(outbuffer + offset + 2) = (this->data_offset >> (8 * 2)) & 0xFF;
40  *(outbuffer + offset + 3) = (this->data_offset >> (8 * 3)) & 0xFF;
41  offset += sizeof(this->data_offset);
42  return offset;
43  }
44 
45  virtual int deserialize(unsigned char *inbuffer)
46  {
47  int offset = 0;
48  uint8_t dim_lengthT = *(inbuffer + offset++);
49  if(dim_lengthT > dim_length)
50  this->dim = (std_msgs::MultiArrayDimension*)realloc(this->dim, dim_lengthT * sizeof(std_msgs::MultiArrayDimension));
51  offset += 3;
52  dim_length = dim_lengthT;
53  for( uint8_t i = 0; i < dim_length; i++){
54  offset += this->st_dim.deserialize(inbuffer + offset);
55  memcpy( &(this->dim[i]), &(this->st_dim), sizeof(std_msgs::MultiArrayDimension));
56  }
57  this->data_offset = ((uint32_t) (*(inbuffer + offset)));
58  this->data_offset |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
59  this->data_offset |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
60  this->data_offset |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
61  offset += sizeof(this->data_offset);
62  return offset;
63  }
64 
65  const char * getType(){ return "std_msgs/MultiArrayLayout"; };
66  const char * getMD5(){ return "0fed2a11c13e11c5571b4e2a995a91a3"; };
67 
68  };
69 
70 }
71 #endif
virtual int serialize(unsigned char *outbuffer) const
Definition: MultiArrayLayout.h:27
Definition: MultiArrayLayout.h:13
virtual int deserialize(unsigned char *inbuffer)
Definition: MultiArrayDimension.h:47
std_msgs::MultiArrayDimension st_dim
Definition: MultiArrayLayout.h:17
const char * getMD5()
Definition: MultiArrayLayout.h:66
uint8_t dim_length
Definition: MultiArrayLayout.h:16
Definition: MultiArrayDimension.h:12
std_msgs::MultiArrayDimension * dim
Definition: MultiArrayLayout.h:18
virtual int serialize(unsigned char *outbuffer) const
Definition: MultiArrayDimension.h:26
MultiArrayLayout()
Definition: MultiArrayLayout.h:21
const char * getType()
Definition: MultiArrayLayout.h:65
Definition: msg.h:43
uint32_t data_offset
Definition: MultiArrayLayout.h:19
virtual int deserialize(unsigned char *inbuffer)
Definition: MultiArrayLayout.h:45