Statistics
| Branch: | Revision:

root / quad2 / arduino / src / ros_lib / std_msgs / Int32.h @ c1426757

History | View | Annotate | Download (1.43 KB)

1
#ifndef _ROS_std_msgs_Int32_h
2
#define _ROS_std_msgs_Int32_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 Int32 : public ros::Msg
13
  {
14
    public:
15
      int32_t data;
16

    
17
    virtual int serialize(unsigned char *outbuffer) const
18
    {
19
      int offset = 0;
20
      union {
21
        int32_t real;
22
        uint32_t base;
23
      } u_data;
24
      u_data.real = this->data;
25
      *(outbuffer + offset + 0) = (u_data.base >> (8 * 0)) & 0xFF;
26
      *(outbuffer + offset + 1) = (u_data.base >> (8 * 1)) & 0xFF;
27
      *(outbuffer + offset + 2) = (u_data.base >> (8 * 2)) & 0xFF;
28
      *(outbuffer + offset + 3) = (u_data.base >> (8 * 3)) & 0xFF;
29
      offset += sizeof(this->data);
30
      return offset;
31
    }
32

    
33
    virtual int deserialize(unsigned char *inbuffer)
34
    {
35
      int offset = 0;
36
      union {
37
        int32_t real;
38
        uint32_t base;
39
      } u_data;
40
      u_data.base = 0;
41
      u_data.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
42
      u_data.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
43
      u_data.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
44
      u_data.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
45
      this->data = u_data.real;
46
      offset += sizeof(this->data);
47
     return offset;
48
    }
49

    
50
    const char * getType(){ return "std_msgs/Int32"; };
51
    const char * getMD5(){ return "da5909fbe378aeaf85e547e830cc1bb7"; };
52

    
53
  };
54

    
55
}
56
#endif