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