catchrobo2022 / Mbed 2 deprecated catchrobo2022_mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Rect.h Source File

Rect.h

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