kitt_platform
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros
String.h
Go to the documentation of this file.
1 #ifndef _ROS_std_msgs_String_h
2 #define _ROS_std_msgs_String_h
3 
4 #include <stdint.h>
5 #include <string.h>
6 #include <stdlib.h>
7 #include "ros/msg.h"
8 
9 namespace std_msgs
10 {
11 
12  class String : public ros::Msg
13  {
14  public:
15  const char* data;
16 
17  String():
18  data("")
19  {
20  }
21 
22  virtual int serialize(unsigned char *outbuffer) const
23  {
24  int offset = 0;
25  uint32_t length_data = strlen(this->data);
26  memcpy(outbuffer + offset, &length_data, sizeof(uint32_t));
27  offset += 4;
28  memcpy(outbuffer + offset, this->data, length_data);
29  offset += length_data;
30  return offset;
31  }
32 
33  virtual int deserialize(unsigned char *inbuffer)
34  {
35  int offset = 0;
36  uint32_t length_data;
37  memcpy(&length_data, (inbuffer + offset), sizeof(uint32_t));
38  offset += 4;
39  for(unsigned int k= offset; k< offset+length_data; ++k){
40  inbuffer[k-1]=inbuffer[k];
41  }
42  inbuffer[offset+length_data-1]=0;
43  this->data = (char *)(inbuffer + offset-1);
44  offset += length_data;
45  return offset;
46  }
47 
48  const char * getType(){ return "std_msgs/String"; };
49  const char * getMD5(){ return "992ce8a1687cec8c8bd883ec73ca41d1"; };
50 
51  };
52 
53 }
54 #endif
const char * getMD5()
Definition: String.h:49
Definition: String.h:12
virtual int deserialize(unsigned char *inbuffer)
Definition: String.h:33
const char * getType()
Definition: String.h:48
const char * data
Definition: String.h:15
String()
Definition: String.h:17
virtual int serialize(unsigned char *outbuffer) const
Definition: String.h:22
Definition: msg.h:43