kitt_platform
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros
Header.h
Go to the documentation of this file.
1 #ifndef _ROS_std_msgs_Header_h
2 #define _ROS_std_msgs_Header_h
3 
4 #include <stdint.h>
5 #include <string.h>
6 #include <stdlib.h>
7 #include "ros/msg.h"
8 #include "ros/time.h"
9 
10 namespace std_msgs
11 {
12 
13  class Header : public ros::Msg
14  {
15  public:
16  uint32_t seq;
18  const char* frame_id;
19 
20  Header():
21  seq(0),
22  stamp(),
23  frame_id("")
24  {
25  }
26 
27  virtual int serialize(unsigned char *outbuffer) const
28  {
29  int offset = 0;
30  *(outbuffer + offset + 0) = (this->seq >> (8 * 0)) & 0xFF;
31  *(outbuffer + offset + 1) = (this->seq >> (8 * 1)) & 0xFF;
32  *(outbuffer + offset + 2) = (this->seq >> (8 * 2)) & 0xFF;
33  *(outbuffer + offset + 3) = (this->seq >> (8 * 3)) & 0xFF;
34  offset += sizeof(this->seq);
35  *(outbuffer + offset + 0) = (this->stamp.sec >> (8 * 0)) & 0xFF;
36  *(outbuffer + offset + 1) = (this->stamp.sec >> (8 * 1)) & 0xFF;
37  *(outbuffer + offset + 2) = (this->stamp.sec >> (8 * 2)) & 0xFF;
38  *(outbuffer + offset + 3) = (this->stamp.sec >> (8 * 3)) & 0xFF;
39  offset += sizeof(this->stamp.sec);
40  *(outbuffer + offset + 0) = (this->stamp.nsec >> (8 * 0)) & 0xFF;
41  *(outbuffer + offset + 1) = (this->stamp.nsec >> (8 * 1)) & 0xFF;
42  *(outbuffer + offset + 2) = (this->stamp.nsec >> (8 * 2)) & 0xFF;
43  *(outbuffer + offset + 3) = (this->stamp.nsec >> (8 * 3)) & 0xFF;
44  offset += sizeof(this->stamp.nsec);
45  uint32_t length_frame_id = strlen(this->frame_id);
46  memcpy(outbuffer + offset, &length_frame_id, sizeof(uint32_t));
47  offset += 4;
48  memcpy(outbuffer + offset, this->frame_id, length_frame_id);
49  offset += length_frame_id;
50  return offset;
51  }
52 
53  virtual int deserialize(unsigned char *inbuffer)
54  {
55  int offset = 0;
56  this->seq = ((uint32_t) (*(inbuffer + offset)));
57  this->seq |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
58  this->seq |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
59  this->seq |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
60  offset += sizeof(this->seq);
61  this->stamp.sec = ((uint32_t) (*(inbuffer + offset)));
62  this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
63  this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
64  this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
65  offset += sizeof(this->stamp.sec);
66  this->stamp.nsec = ((uint32_t) (*(inbuffer + offset)));
67  this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
68  this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
69  this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
70  offset += sizeof(this->stamp.nsec);
71  uint32_t length_frame_id;
72  memcpy(&length_frame_id, (inbuffer + offset), sizeof(uint32_t));
73  offset += 4;
74  for(unsigned int k= offset; k< offset+length_frame_id; ++k){
75  inbuffer[k-1]=inbuffer[k];
76  }
77  inbuffer[offset+length_frame_id-1]=0;
78  this->frame_id = (char *)(inbuffer + offset-1);
79  offset += length_frame_id;
80  return offset;
81  }
82 
83  const char * getType(){ return "std_msgs/Header"; };
84  const char * getMD5(){ return "2176decaecbce78abc3b96ef049fabed"; };
85 
86  };
87 
88 }
89 #endif
virtual int deserialize(unsigned char *inbuffer)
Definition: Header.h:53
Header()
Definition: Header.h:20
uint32_t nsec
Definition: time.h:50
uint32_t sec
Definition: time.h:50
Definition: time.h:47
const char * frame_id
Definition: Header.h:18
virtual int serialize(unsigned char *outbuffer) const
Definition: Header.h:27
Definition: Header.h:13
const char * getMD5()
Definition: Header.h:84
const char * getType()
Definition: Header.h:83
uint32_t seq
Definition: Header.h:16
ros::Time stamp
Definition: Header.h:17
Definition: msg.h:43