kitt_platform
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros
InteractiveMarkerInit.h
Go to the documentation of this file.
1 #ifndef _ROS_visualization_msgs_InteractiveMarkerInit_h
2 #define _ROS_visualization_msgs_InteractiveMarkerInit_h
3 
4 #include <stdint.h>
5 #include <string.h>
6 #include <stdlib.h>
7 #include "ros/msg.h"
9 
10 namespace visualization_msgs
11 {
12 
14  {
15  public:
16  const char* server_id;
17  uint64_t seq_num;
18  uint8_t markers_length;
21 
23  server_id(""),
24  seq_num(0),
25  markers_length(0), markers(NULL)
26  {
27  }
28 
29  virtual int serialize(unsigned char *outbuffer) const
30  {
31  int offset = 0;
32  uint32_t length_server_id = strlen(this->server_id);
33  memcpy(outbuffer + offset, &length_server_id, sizeof(uint32_t));
34  offset += 4;
35  memcpy(outbuffer + offset, this->server_id, length_server_id);
36  offset += length_server_id;
37  union {
38  uint64_t real;
39  uint32_t base;
40  } u_seq_num;
41  u_seq_num.real = this->seq_num;
42  *(outbuffer + offset + 0) = (u_seq_num.base >> (8 * 0)) & 0xFF;
43  *(outbuffer + offset + 1) = (u_seq_num.base >> (8 * 1)) & 0xFF;
44  *(outbuffer + offset + 2) = (u_seq_num.base >> (8 * 2)) & 0xFF;
45  *(outbuffer + offset + 3) = (u_seq_num.base >> (8 * 3)) & 0xFF;
46  offset += sizeof(this->seq_num);
47  *(outbuffer + offset++) = markers_length;
48  *(outbuffer + offset++) = 0;
49  *(outbuffer + offset++) = 0;
50  *(outbuffer + offset++) = 0;
51  for( uint8_t i = 0; i < markers_length; i++){
52  offset += this->markers[i].serialize(outbuffer + offset);
53  }
54  return offset;
55  }
56 
57  virtual int deserialize(unsigned char *inbuffer)
58  {
59  int offset = 0;
60  uint32_t length_server_id;
61  memcpy(&length_server_id, (inbuffer + offset), sizeof(uint32_t));
62  offset += 4;
63  for(unsigned int k= offset; k< offset+length_server_id; ++k){
64  inbuffer[k-1]=inbuffer[k];
65  }
66  inbuffer[offset+length_server_id-1]=0;
67  this->server_id = (char *)(inbuffer + offset-1);
68  offset += length_server_id;
69  union {
70  uint64_t real;
71  uint32_t base;
72  } u_seq_num;
73  u_seq_num.base = 0;
74  u_seq_num.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
75  u_seq_num.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
76  u_seq_num.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
77  u_seq_num.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
78  this->seq_num = u_seq_num.real;
79  offset += sizeof(this->seq_num);
80  uint8_t markers_lengthT = *(inbuffer + offset++);
81  if(markers_lengthT > markers_length)
82  this->markers = (visualization_msgs::InteractiveMarker*)realloc(this->markers, markers_lengthT * sizeof(visualization_msgs::InteractiveMarker));
83  offset += 3;
84  markers_length = markers_lengthT;
85  for( uint8_t i = 0; i < markers_length; i++){
86  offset += this->st_markers.deserialize(inbuffer + offset);
87  memcpy( &(this->markers[i]), &(this->st_markers), sizeof(visualization_msgs::InteractiveMarker));
88  }
89  return offset;
90  }
91 
92  const char * getType(){ return "visualization_msgs/InteractiveMarkerInit"; };
93  const char * getMD5(){ return "aa2f1dcea79533d1710675195653028d"; };
94 
95  };
96 
97 }
98 #endif
const char * server_id
Definition: InteractiveMarkerInit.h:16
Definition: InteractiveMarker.h:16
InteractiveMarkerInit()
Definition: InteractiveMarkerInit.h:22
virtual int deserialize(unsigned char *inbuffer)
Definition: InteractiveMarker.h:84
virtual int serialize(unsigned char *outbuffer) const
Definition: InteractiveMarkerInit.h:29
virtual int deserialize(unsigned char *inbuffer)
Definition: InteractiveMarkerInit.h:57
virtual int serialize(unsigned char *outbuffer) const
Definition: InteractiveMarker.h:42
uint8_t markers_length
Definition: InteractiveMarkerInit.h:18
const char * getType()
Definition: InteractiveMarkerInit.h:92
uint64_t seq_num
Definition: InteractiveMarkerInit.h:17
Definition: InteractiveMarkerInit.h:13
visualization_msgs::InteractiveMarker st_markers
Definition: InteractiveMarkerInit.h:19
const char * getMD5()
Definition: InteractiveMarkerInit.h:93
Definition: msg.h:43
visualization_msgs::InteractiveMarker * markers
Definition: InteractiveMarkerInit.h:20