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