catchrobo2022 / Mbed 2 deprecated catchrobo2022_mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers PlotDataArray.h Source File

PlotDataArray.h

00001 #ifndef _ROS_jsk_recognition_msgs_PlotDataArray_h
00002 #define _ROS_jsk_recognition_msgs_PlotDataArray_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "std_msgs/Header.h"
00009 #include "jsk_recognition_msgs/PlotData.h"
00010 
00011 namespace jsk_recognition_msgs
00012 {
00013 
00014   class PlotDataArray : public ros::Msg
00015   {
00016     public:
00017       typedef std_msgs::Header _header_type;
00018       _header_type header;
00019       uint32_t data_length;
00020       typedef jsk_recognition_msgs::PlotData _data_type;
00021       _data_type st_data;
00022       _data_type * data;
00023       typedef bool _no_legend_type;
00024       _no_legend_type no_legend;
00025       typedef float _legend_font_size_type;
00026       _legend_font_size_type legend_font_size;
00027       typedef float _max_x_type;
00028       _max_x_type max_x;
00029       typedef float _min_x_type;
00030       _min_x_type min_x;
00031       typedef float _min_y_type;
00032       _min_y_type min_y;
00033       typedef float _max_y_type;
00034       _max_y_type max_y;
00035 
00036     PlotDataArray():
00037       header(),
00038       data_length(0), data(NULL),
00039       no_legend(0),
00040       legend_font_size(0),
00041       max_x(0),
00042       min_x(0),
00043       min_y(0),
00044       max_y(0)
00045     {
00046     }
00047 
00048     virtual int serialize(unsigned char *outbuffer) const
00049     {
00050       int offset = 0;
00051       offset += this->header.serialize(outbuffer + offset);
00052       *(outbuffer + offset + 0) = (this->data_length >> (8 * 0)) & 0xFF;
00053       *(outbuffer + offset + 1) = (this->data_length >> (8 * 1)) & 0xFF;
00054       *(outbuffer + offset + 2) = (this->data_length >> (8 * 2)) & 0xFF;
00055       *(outbuffer + offset + 3) = (this->data_length >> (8 * 3)) & 0xFF;
00056       offset += sizeof(this->data_length);
00057       for( uint32_t i = 0; i < data_length; i++){
00058       offset += this->data[i].serialize(outbuffer + offset);
00059       }
00060       union {
00061         bool real;
00062         uint8_t base;
00063       } u_no_legend;
00064       u_no_legend.real = this->no_legend;
00065       *(outbuffer + offset + 0) = (u_no_legend.base >> (8 * 0)) & 0xFF;
00066       offset += sizeof(this->no_legend);
00067       union {
00068         float real;
00069         uint32_t base;
00070       } u_legend_font_size;
00071       u_legend_font_size.real = this->legend_font_size;
00072       *(outbuffer + offset + 0) = (u_legend_font_size.base >> (8 * 0)) & 0xFF;
00073       *(outbuffer + offset + 1) = (u_legend_font_size.base >> (8 * 1)) & 0xFF;
00074       *(outbuffer + offset + 2) = (u_legend_font_size.base >> (8 * 2)) & 0xFF;
00075       *(outbuffer + offset + 3) = (u_legend_font_size.base >> (8 * 3)) & 0xFF;
00076       offset += sizeof(this->legend_font_size);
00077       union {
00078         float real;
00079         uint32_t base;
00080       } u_max_x;
00081       u_max_x.real = this->max_x;
00082       *(outbuffer + offset + 0) = (u_max_x.base >> (8 * 0)) & 0xFF;
00083       *(outbuffer + offset + 1) = (u_max_x.base >> (8 * 1)) & 0xFF;
00084       *(outbuffer + offset + 2) = (u_max_x.base >> (8 * 2)) & 0xFF;
00085       *(outbuffer + offset + 3) = (u_max_x.base >> (8 * 3)) & 0xFF;
00086       offset += sizeof(this->max_x);
00087       union {
00088         float real;
00089         uint32_t base;
00090       } u_min_x;
00091       u_min_x.real = this->min_x;
00092       *(outbuffer + offset + 0) = (u_min_x.base >> (8 * 0)) & 0xFF;
00093       *(outbuffer + offset + 1) = (u_min_x.base >> (8 * 1)) & 0xFF;
00094       *(outbuffer + offset + 2) = (u_min_x.base >> (8 * 2)) & 0xFF;
00095       *(outbuffer + offset + 3) = (u_min_x.base >> (8 * 3)) & 0xFF;
00096       offset += sizeof(this->min_x);
00097       union {
00098         float real;
00099         uint32_t base;
00100       } u_min_y;
00101       u_min_y.real = this->min_y;
00102       *(outbuffer + offset + 0) = (u_min_y.base >> (8 * 0)) & 0xFF;
00103       *(outbuffer + offset + 1) = (u_min_y.base >> (8 * 1)) & 0xFF;
00104       *(outbuffer + offset + 2) = (u_min_y.base >> (8 * 2)) & 0xFF;
00105       *(outbuffer + offset + 3) = (u_min_y.base >> (8 * 3)) & 0xFF;
00106       offset += sizeof(this->min_y);
00107       union {
00108         float real;
00109         uint32_t base;
00110       } u_max_y;
00111       u_max_y.real = this->max_y;
00112       *(outbuffer + offset + 0) = (u_max_y.base >> (8 * 0)) & 0xFF;
00113       *(outbuffer + offset + 1) = (u_max_y.base >> (8 * 1)) & 0xFF;
00114       *(outbuffer + offset + 2) = (u_max_y.base >> (8 * 2)) & 0xFF;
00115       *(outbuffer + offset + 3) = (u_max_y.base >> (8 * 3)) & 0xFF;
00116       offset += sizeof(this->max_y);
00117       return offset;
00118     }
00119 
00120     virtual int deserialize(unsigned char *inbuffer)
00121     {
00122       int offset = 0;
00123       offset += this->header.deserialize(inbuffer + offset);
00124       uint32_t data_lengthT = ((uint32_t) (*(inbuffer + offset))); 
00125       data_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 
00126       data_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 
00127       data_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 
00128       offset += sizeof(this->data_length);
00129       if(data_lengthT > data_length)
00130         this->data = (jsk_recognition_msgs::PlotData*)realloc(this->data, data_lengthT * sizeof(jsk_recognition_msgs::PlotData));
00131       data_length = data_lengthT;
00132       for( uint32_t i = 0; i < data_length; i++){
00133       offset += this->st_data.deserialize(inbuffer + offset);
00134         memcpy( &(this->data[i]), &(this->st_data), sizeof(jsk_recognition_msgs::PlotData));
00135       }
00136       union {
00137         bool real;
00138         uint8_t base;
00139       } u_no_legend;
00140       u_no_legend.base = 0;
00141       u_no_legend.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00142       this->no_legend = u_no_legend.real;
00143       offset += sizeof(this->no_legend);
00144       union {
00145         float real;
00146         uint32_t base;
00147       } u_legend_font_size;
00148       u_legend_font_size.base = 0;
00149       u_legend_font_size.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00150       u_legend_font_size.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00151       u_legend_font_size.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00152       u_legend_font_size.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00153       this->legend_font_size = u_legend_font_size.real;
00154       offset += sizeof(this->legend_font_size);
00155       union {
00156         float real;
00157         uint32_t base;
00158       } u_max_x;
00159       u_max_x.base = 0;
00160       u_max_x.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00161       u_max_x.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00162       u_max_x.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00163       u_max_x.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00164       this->max_x = u_max_x.real;
00165       offset += sizeof(this->max_x);
00166       union {
00167         float real;
00168         uint32_t base;
00169       } u_min_x;
00170       u_min_x.base = 0;
00171       u_min_x.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00172       u_min_x.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00173       u_min_x.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00174       u_min_x.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00175       this->min_x = u_min_x.real;
00176       offset += sizeof(this->min_x);
00177       union {
00178         float real;
00179         uint32_t base;
00180       } u_min_y;
00181       u_min_y.base = 0;
00182       u_min_y.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00183       u_min_y.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00184       u_min_y.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00185       u_min_y.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00186       this->min_y = u_min_y.real;
00187       offset += sizeof(this->min_y);
00188       union {
00189         float real;
00190         uint32_t base;
00191       } u_max_y;
00192       u_max_y.base = 0;
00193       u_max_y.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00194       u_max_y.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00195       u_max_y.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00196       u_max_y.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00197       this->max_y = u_max_y.real;
00198       offset += sizeof(this->max_y);
00199      return offset;
00200     }
00201 
00202     virtual const char * getType(){ return "jsk_recognition_msgs/PlotDataArray"; };
00203     virtual const char * getMD5(){ return "e83e9378b374b8436f955a6cd212770a"; };
00204 
00205   };
00206 
00207 }
00208 #endif