Project

General

Profile

Statistics
| Branch: | Revision:

root / scout_avr / src / ros_lib / std_msgs / Int16.h @ 88fb3a79

History | View | Annotate | Download (1.16 KB)

1
#ifndef _ROS_std_msgs_Int16_h
2
#define _ROS_std_msgs_Int16_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 Int16 : public ros::Msg
13
  {
14
    public:
15
      int16_t data;
16

    
17
    virtual int serialize(unsigned char *outbuffer) const
18
    {
19
      int offset = 0;
20
      union {
21
        int16_t real;
22
        uint16_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
      offset += sizeof(this->data);
28
      return offset;
29
    }
30

    
31
    virtual int deserialize(unsigned char *inbuffer)
32
    {
33
      int offset = 0;
34
      union {
35
        int16_t real;
36
        uint16_t base;
37
      } u_data;
38
      u_data.base = 0;
39
      u_data.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0);
40
      u_data.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
41
      this->data = u_data.real;
42
      offset += sizeof(this->data);
43
     return offset;
44
    }
45

    
46
    const char * getType(){ return "std_msgs/Int16"; };
47
    const char * getMD5(){ return "8524586e34fbd7cb1c08c5f5f1ca0e57"; };
48

    
49
  };
50

    
51
}
52
#endif