Working towards recieving twists

Dependencies:   BufferedSerial

Fork of ros_lib_kinetic by Gary Servin

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ColorRGBA.h Source File

ColorRGBA.h

00001 #ifndef _ROS_std_msgs_ColorRGBA_h
00002 #define _ROS_std_msgs_ColorRGBA_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace std_msgs
00010 {
00011 
00012   class ColorRGBA : public ros::Msg
00013   {
00014     public:
00015       typedef float _r_type;
00016       _r_type r;
00017       typedef float _g_type;
00018       _g_type g;
00019       typedef float _b_type;
00020       _b_type b;
00021       typedef float _a_type;
00022       _a_type a;
00023 
00024     ColorRGBA():
00025       r(0),
00026       g(0),
00027       b(0),
00028       a(0)
00029     {
00030     }
00031 
00032     virtual int serialize(unsigned char *outbuffer) const
00033     {
00034       int offset = 0;
00035       union {
00036         float real;
00037         uint32_t base;
00038       } u_r;
00039       u_r.real = this->r;
00040       *(outbuffer + offset + 0) = (u_r.base >> (8 * 0)) & 0xFF;
00041       *(outbuffer + offset + 1) = (u_r.base >> (8 * 1)) & 0xFF;
00042       *(outbuffer + offset + 2) = (u_r.base >> (8 * 2)) & 0xFF;
00043       *(outbuffer + offset + 3) = (u_r.base >> (8 * 3)) & 0xFF;
00044       offset += sizeof(this->r);
00045       union {
00046         float real;
00047         uint32_t base;
00048       } u_g;
00049       u_g.real = this->g;
00050       *(outbuffer + offset + 0) = (u_g.base >> (8 * 0)) & 0xFF;
00051       *(outbuffer + offset + 1) = (u_g.base >> (8 * 1)) & 0xFF;
00052       *(outbuffer + offset + 2) = (u_g.base >> (8 * 2)) & 0xFF;
00053       *(outbuffer + offset + 3) = (u_g.base >> (8 * 3)) & 0xFF;
00054       offset += sizeof(this->g);
00055       union {
00056         float real;
00057         uint32_t base;
00058       } u_b;
00059       u_b.real = this->b;
00060       *(outbuffer + offset + 0) = (u_b.base >> (8 * 0)) & 0xFF;
00061       *(outbuffer + offset + 1) = (u_b.base >> (8 * 1)) & 0xFF;
00062       *(outbuffer + offset + 2) = (u_b.base >> (8 * 2)) & 0xFF;
00063       *(outbuffer + offset + 3) = (u_b.base >> (8 * 3)) & 0xFF;
00064       offset += sizeof(this->b);
00065       union {
00066         float real;
00067         uint32_t base;
00068       } u_a;
00069       u_a.real = this->a;
00070       *(outbuffer + offset + 0) = (u_a.base >> (8 * 0)) & 0xFF;
00071       *(outbuffer + offset + 1) = (u_a.base >> (8 * 1)) & 0xFF;
00072       *(outbuffer + offset + 2) = (u_a.base >> (8 * 2)) & 0xFF;
00073       *(outbuffer + offset + 3) = (u_a.base >> (8 * 3)) & 0xFF;
00074       offset += sizeof(this->a);
00075       return offset;
00076     }
00077 
00078     virtual int deserialize(unsigned char *inbuffer)
00079     {
00080       int offset = 0;
00081       union {
00082         float real;
00083         uint32_t base;
00084       } u_r;
00085       u_r.base = 0;
00086       u_r.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00087       u_r.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00088       u_r.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00089       u_r.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00090       this->r = u_r.real;
00091       offset += sizeof(this->r);
00092       union {
00093         float real;
00094         uint32_t base;
00095       } u_g;
00096       u_g.base = 0;
00097       u_g.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00098       u_g.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00099       u_g.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00100       u_g.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00101       this->g = u_g.real;
00102       offset += sizeof(this->g);
00103       union {
00104         float real;
00105         uint32_t base;
00106       } u_b;
00107       u_b.base = 0;
00108       u_b.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00109       u_b.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00110       u_b.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00111       u_b.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00112       this->b = u_b.real;
00113       offset += sizeof(this->b);
00114       union {
00115         float real;
00116         uint32_t base;
00117       } u_a;
00118       u_a.base = 0;
00119       u_a.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00120       u_a.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00121       u_a.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00122       u_a.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00123       this->a = u_a.real;
00124       offset += sizeof(this->a);
00125      return offset;
00126     }
00127 
00128     const char * getType(){ return "std_msgs/ColorRGBA"; };
00129     const char * getMD5(){ return "a29a96539573343b1310c73607334b00"; };
00130 
00131   };
00132 
00133 }
00134 #endif