kitt_platform
All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros
DemuxSelect.h
Go to the documentation of this file.
1 #ifndef _ROS_SERVICE_DemuxSelect_h
2 #define _ROS_SERVICE_DemuxSelect_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 DEMUXSELECT[] = "topic_tools/DemuxSelect";
12 
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 DEMUXSELECT; };
50  const char * getMD5(){ return "d8f94bae31b356b24d0427f80426d0c3"; };
51 
52  };
53 
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 DEMUXSELECT; };
91  const char * getMD5(){ return "3db0a473debdbafea387c9e49358c320"; };
92 
93  };
94 
95  class DemuxSelect {
96  public:
99  };
100 
101 }
102 #endif
Definition: DemuxSelect.h:13
DemuxSelectResponse()
Definition: DemuxSelect.h:59
DemuxSelectResponse Response
Definition: DemuxSelect.h:98
Definition: DemuxSelect.h:95
DemuxSelectRequest()
Definition: DemuxSelect.h:18
static const char DEMUXSELECT[]
Definition: DemuxSelect.h:11
const char * getType()
Definition: DemuxSelect.h:49
DemuxSelectRequest Request
Definition: DemuxSelect.h:97
const char * getMD5()
Definition: DemuxSelect.h:91
Definition: DemuxSelect.h:54
virtual int serialize(unsigned char *outbuffer) const
Definition: DemuxSelect.h:64
const char * getMD5()
Definition: DemuxSelect.h:50
virtual int deserialize(unsigned char *inbuffer)
Definition: DemuxSelect.h:75
const char * prev_topic
Definition: DemuxSelect.h:57
virtual int serialize(unsigned char *outbuffer) const
Definition: DemuxSelect.h:23
Definition: msg.h:43
const char * topic
Definition: DemuxSelect.h:16
virtual int deserialize(unsigned char *inbuffer)
Definition: DemuxSelect.h:34
const char * getType()
Definition: DemuxSelect.h:90