Go to the documentation of this file.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 float r;
00016 float g;
00017 float b;
00018 float a;
00019
00020 virtual int serialize(unsigned char *outbuffer)
00021 {
00022 int offset = 0;
00023 union {
00024 float real;
00025 unsigned long base;
00026 } u_r;
00027 u_r.real = this->r;
00028 *(outbuffer + offset + 0) = (u_r.base >> (8 * 0)) & 0xFF;
00029 *(outbuffer + offset + 1) = (u_r.base >> (8 * 1)) & 0xFF;
00030 *(outbuffer + offset + 2) = (u_r.base >> (8 * 2)) & 0xFF;
00031 *(outbuffer + offset + 3) = (u_r.base >> (8 * 3)) & 0xFF;
00032 offset += sizeof(this->r);
00033 union {
00034 float real;
00035 unsigned long base;
00036 } u_g;
00037 u_g.real = this->g;
00038 *(outbuffer + offset + 0) = (u_g.base >> (8 * 0)) & 0xFF;
00039 *(outbuffer + offset + 1) = (u_g.base >> (8 * 1)) & 0xFF;
00040 *(outbuffer + offset + 2) = (u_g.base >> (8 * 2)) & 0xFF;
00041 *(outbuffer + offset + 3) = (u_g.base >> (8 * 3)) & 0xFF;
00042 offset += sizeof(this->g);
00043 union {
00044 float real;
00045 unsigned long base;
00046 } u_b;
00047 u_b.real = this->b;
00048 *(outbuffer + offset + 0) = (u_b.base >> (8 * 0)) & 0xFF;
00049 *(outbuffer + offset + 1) = (u_b.base >> (8 * 1)) & 0xFF;
00050 *(outbuffer + offset + 2) = (u_b.base >> (8 * 2)) & 0xFF;
00051 *(outbuffer + offset + 3) = (u_b.base >> (8 * 3)) & 0xFF;
00052 offset += sizeof(this->b);
00053 union {
00054 float real;
00055 unsigned long base;
00056 } u_a;
00057 u_a.real = this->a;
00058 *(outbuffer + offset + 0) = (u_a.base >> (8 * 0)) & 0xFF;
00059 *(outbuffer + offset + 1) = (u_a.base >> (8 * 1)) & 0xFF;
00060 *(outbuffer + offset + 2) = (u_a.base >> (8 * 2)) & 0xFF;
00061 *(outbuffer + offset + 3) = (u_a.base >> (8 * 3)) & 0xFF;
00062 offset += sizeof(this->a);
00063 return offset;
00064 }
00065
00066 virtual int deserialize(unsigned char *inbuffer)
00067 {
00068 int offset = 0;
00069 union {
00070 float real;
00071 unsigned long base;
00072 } u_r;
00073 u_r.base = 0;
00074 u_r.base |= ((typeof(u_r.base)) (*(inbuffer + offset + 0))) << (8 * 0);
00075 u_r.base |= ((typeof(u_r.base)) (*(inbuffer + offset + 1))) << (8 * 1);
00076 u_r.base |= ((typeof(u_r.base)) (*(inbuffer + offset + 2))) << (8 * 2);
00077 u_r.base |= ((typeof(u_r.base)) (*(inbuffer + offset + 3))) << (8 * 3);
00078 this->r = u_r.real;
00079 offset += sizeof(this->r);
00080 union {
00081 float real;
00082 unsigned long base;
00083 } u_g;
00084 u_g.base = 0;
00085 u_g.base |= ((typeof(u_g.base)) (*(inbuffer + offset + 0))) << (8 * 0);
00086 u_g.base |= ((typeof(u_g.base)) (*(inbuffer + offset + 1))) << (8 * 1);
00087 u_g.base |= ((typeof(u_g.base)) (*(inbuffer + offset + 2))) << (8 * 2);
00088 u_g.base |= ((typeof(u_g.base)) (*(inbuffer + offset + 3))) << (8 * 3);
00089 this->g = u_g.real;
00090 offset += sizeof(this->g);
00091 union {
00092 float real;
00093 unsigned long base;
00094 } u_b;
00095 u_b.base = 0;
00096 u_b.base |= ((typeof(u_b.base)) (*(inbuffer + offset + 0))) << (8 * 0);
00097 u_b.base |= ((typeof(u_b.base)) (*(inbuffer + offset + 1))) << (8 * 1);
00098 u_b.base |= ((typeof(u_b.base)) (*(inbuffer + offset + 2))) << (8 * 2);
00099 u_b.base |= ((typeof(u_b.base)) (*(inbuffer + offset + 3))) << (8 * 3);
00100 this->b = u_b.real;
00101 offset += sizeof(this->b);
00102 union {
00103 float real;
00104 unsigned long base;
00105 } u_a;
00106 u_a.base = 0;
00107 u_a.base |= ((typeof(u_a.base)) (*(inbuffer + offset + 0))) << (8 * 0);
00108 u_a.base |= ((typeof(u_a.base)) (*(inbuffer + offset + 1))) << (8 * 1);
00109 u_a.base |= ((typeof(u_a.base)) (*(inbuffer + offset + 2))) << (8 * 2);
00110 u_a.base |= ((typeof(u_a.base)) (*(inbuffer + offset + 3))) << (8 * 3);
00111 this->a = u_a.real;
00112 offset += sizeof(this->a);
00113 return offset;
00114 }
00115
00116 const char * getType(){ return "std_msgs/ColorRGBA"; };
00117
00118 };
00119
00120 }
00121 #endif