Project

General

Profile

Statistics
| Branch: | Revision:

root / quad2 / arduino / src / ros_lib / sensor_msgs / RegionOfInterest.h @ c1426757

History | View | Annotate | Download (3.78 KB)

1
#ifndef _ROS_sensor_msgs_RegionOfInterest_h
2
#define _ROS_sensor_msgs_RegionOfInterest_h
3

    
4
#include <stdint.h>
5
#include <string.h>
6
#include <stdlib.h>
7
#include "ros/msg.h"
8

    
9
namespace sensor_msgs
10
{
11

    
12
  class RegionOfInterest : public ros::Msg
13
  {
14
    public:
15
      uint32_t x_offset;
16
      uint32_t y_offset;
17
      uint32_t height;
18
      uint32_t width;
19
      bool do_rectify;
20

    
21
    virtual int serialize(unsigned char *outbuffer) const
22
    {
23
      int offset = 0;
24
      *(outbuffer + offset + 0) = (this->x_offset >> (8 * 0)) & 0xFF;
25
      *(outbuffer + offset + 1) = (this->x_offset >> (8 * 1)) & 0xFF;
26
      *(outbuffer + offset + 2) = (this->x_offset >> (8 * 2)) & 0xFF;
27
      *(outbuffer + offset + 3) = (this->x_offset >> (8 * 3)) & 0xFF;
28
      offset += sizeof(this->x_offset);
29
      *(outbuffer + offset + 0) = (this->y_offset >> (8 * 0)) & 0xFF;
30
      *(outbuffer + offset + 1) = (this->y_offset >> (8 * 1)) & 0xFF;
31
      *(outbuffer + offset + 2) = (this->y_offset >> (8 * 2)) & 0xFF;
32
      *(outbuffer + offset + 3) = (this->y_offset >> (8 * 3)) & 0xFF;
33
      offset += sizeof(this->y_offset);
34
      *(outbuffer + offset + 0) = (this->height >> (8 * 0)) & 0xFF;
35
      *(outbuffer + offset + 1) = (this->height >> (8 * 1)) & 0xFF;
36
      *(outbuffer + offset + 2) = (this->height >> (8 * 2)) & 0xFF;
37
      *(outbuffer + offset + 3) = (this->height >> (8 * 3)) & 0xFF;
38
      offset += sizeof(this->height);
39
      *(outbuffer + offset + 0) = (this->width >> (8 * 0)) & 0xFF;
40
      *(outbuffer + offset + 1) = (this->width >> (8 * 1)) & 0xFF;
41
      *(outbuffer + offset + 2) = (this->width >> (8 * 2)) & 0xFF;
42
      *(outbuffer + offset + 3) = (this->width >> (8 * 3)) & 0xFF;
43
      offset += sizeof(this->width);
44
      union {
45
        bool real;
46
        uint8_t base;
47
      } u_do_rectify;
48
      u_do_rectify.real = this->do_rectify;
49
      *(outbuffer + offset + 0) = (u_do_rectify.base >> (8 * 0)) & 0xFF;
50
      offset += sizeof(this->do_rectify);
51
      return offset;
52
    }
53

    
54
    virtual int deserialize(unsigned char *inbuffer)
55
    {
56
      int offset = 0;
57
      this->x_offset |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
58
      this->x_offset |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
59
      this->x_offset |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
60
      this->x_offset |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
61
      offset += sizeof(this->x_offset);
62
      this->y_offset |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
63
      this->y_offset |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
64
      this->y_offset |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
65
      this->y_offset |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
66
      offset += sizeof(this->y_offset);
67
      this->height |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
68
      this->height |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
69
      this->height |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
70
      this->height |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
71
      offset += sizeof(this->height);
72
      this->width |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
73
      this->width |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
74
      this->width |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
75
      this->width |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
76
      offset += sizeof(this->width);
77
      union {
78
        bool real;
79
        uint8_t base;
80
      } u_do_rectify;
81
      u_do_rectify.base = 0;
82
      u_do_rectify.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
83
      this->do_rectify = u_do_rectify.real;
84
      offset += sizeof(this->do_rectify);
85
     return offset;
86
    }
87

    
88
    const char * getType(){ return "sensor_msgs/RegionOfInterest"; };
89
    const char * getMD5(){ return "bdb633039d588fcccb441a4d43ccfe09"; };
90

    
91
  };
92

    
93
}
94
#endif