Statistics
| Branch: | Revision:

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

History | View | Annotate | Download (3.82 KB)

1
#ifndef _ROS_std_msgs_ColorRGBA_h
2
#define _ROS_std_msgs_ColorRGBA_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 ColorRGBA : public ros::Msg
13
  {
14
    public:
15
      float r;
16
      float g;
17
      float b;
18
      float a;
19

    
20
    virtual int serialize(unsigned char *outbuffer) const
21
    {
22
      int offset = 0;
23
      union {
24
        float real;
25
        uint32_t base;
26
      } u_r;
27
      u_r.real = this->r;
28
      *(outbuffer + offset + 0) = (u_r.base >> (8 * 0)) & 0xFF;
29
      *(outbuffer + offset + 1) = (u_r.base >> (8 * 1)) & 0xFF;
30
      *(outbuffer + offset + 2) = (u_r.base >> (8 * 2)) & 0xFF;
31
      *(outbuffer + offset + 3) = (u_r.base >> (8 * 3)) & 0xFF;
32
      offset += sizeof(this->r);
33
      union {
34
        float real;
35
        uint32_t base;
36
      } u_g;
37
      u_g.real = this->g;
38
      *(outbuffer + offset + 0) = (u_g.base >> (8 * 0)) & 0xFF;
39
      *(outbuffer + offset + 1) = (u_g.base >> (8 * 1)) & 0xFF;
40
      *(outbuffer + offset + 2) = (u_g.base >> (8 * 2)) & 0xFF;
41
      *(outbuffer + offset + 3) = (u_g.base >> (8 * 3)) & 0xFF;
42
      offset += sizeof(this->g);
43
      union {
44
        float real;
45
        uint32_t base;
46
      } u_b;
47
      u_b.real = this->b;
48
      *(outbuffer + offset + 0) = (u_b.base >> (8 * 0)) & 0xFF;
49
      *(outbuffer + offset + 1) = (u_b.base >> (8 * 1)) & 0xFF;
50
      *(outbuffer + offset + 2) = (u_b.base >> (8 * 2)) & 0xFF;
51
      *(outbuffer + offset + 3) = (u_b.base >> (8 * 3)) & 0xFF;
52
      offset += sizeof(this->b);
53
      union {
54
        float real;
55
        uint32_t base;
56
      } u_a;
57
      u_a.real = this->a;
58
      *(outbuffer + offset + 0) = (u_a.base >> (8 * 0)) & 0xFF;
59
      *(outbuffer + offset + 1) = (u_a.base >> (8 * 1)) & 0xFF;
60
      *(outbuffer + offset + 2) = (u_a.base >> (8 * 2)) & 0xFF;
61
      *(outbuffer + offset + 3) = (u_a.base >> (8 * 3)) & 0xFF;
62
      offset += sizeof(this->a);
63
      return offset;
64
    }
65

    
66
    virtual int deserialize(unsigned char *inbuffer)
67
    {
68
      int offset = 0;
69
      union {
70
        float real;
71
        uint32_t base;
72
      } u_r;
73
      u_r.base = 0;
74
      u_r.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
75
      u_r.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
76
      u_r.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
77
      u_r.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
78
      this->r = u_r.real;
79
      offset += sizeof(this->r);
80
      union {
81
        float real;
82
        uint32_t base;
83
      } u_g;
84
      u_g.base = 0;
85
      u_g.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
86
      u_g.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
87
      u_g.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
88
      u_g.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
89
      this->g = u_g.real;
90
      offset += sizeof(this->g);
91
      union {
92
        float real;
93
        uint32_t base;
94
      } u_b;
95
      u_b.base = 0;
96
      u_b.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
97
      u_b.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
98
      u_b.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
99
      u_b.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
100
      this->b = u_b.real;
101
      offset += sizeof(this->b);
102
      union {
103
        float real;
104
        uint32_t base;
105
      } u_a;
106
      u_a.base = 0;
107
      u_a.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
108
      u_a.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
109
      u_a.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
110
      u_a.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
111
      this->a = u_a.real;
112
      offset += sizeof(this->a);
113
     return offset;
114
    }
115

    
116
    const char * getType(){ return "std_msgs/ColorRGBA"; };
117
    const char * getMD5(){ return "a29a96539573343b1310c73607334b00"; };
118

    
119
  };
120

    
121
}
122
#endif