GridCells.h
Go to the documentation of this file.
00001 #ifndef _ROS_nav_msgs_GridCells_h
00002 #define _ROS_nav_msgs_GridCells_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 "geometry_msgs/Point.h"
00010 
00011 namespace nav_msgs
00012 {
00013 
00014   class GridCells : public ros::Msg
00015   {
00016     public:
00017       std_msgs::Header header;
00018       float cell_width;
00019       float cell_height;
00020       uint8_t cells_length;
00021       geometry_msgs::Point st_cells;
00022       geometry_msgs::Point * cells;
00023 
00024     virtual int serialize(unsigned char *outbuffer) const
00025     {
00026       int offset = 0;
00027       offset += this->header.serialize(outbuffer + offset);
00028       union {
00029         float real;
00030         uint32_t base;
00031       } u_cell_width;
00032       u_cell_width.real = this->cell_width;
00033       *(outbuffer + offset + 0) = (u_cell_width.base >> (8 * 0)) & 0xFF;
00034       *(outbuffer + offset + 1) = (u_cell_width.base >> (8 * 1)) & 0xFF;
00035       *(outbuffer + offset + 2) = (u_cell_width.base >> (8 * 2)) & 0xFF;
00036       *(outbuffer + offset + 3) = (u_cell_width.base >> (8 * 3)) & 0xFF;
00037       offset += sizeof(this->cell_width);
00038       union {
00039         float real;
00040         uint32_t base;
00041       } u_cell_height;
00042       u_cell_height.real = this->cell_height;
00043       *(outbuffer + offset + 0) = (u_cell_height.base >> (8 * 0)) & 0xFF;
00044       *(outbuffer + offset + 1) = (u_cell_height.base >> (8 * 1)) & 0xFF;
00045       *(outbuffer + offset + 2) = (u_cell_height.base >> (8 * 2)) & 0xFF;
00046       *(outbuffer + offset + 3) = (u_cell_height.base >> (8 * 3)) & 0xFF;
00047       offset += sizeof(this->cell_height);
00048       *(outbuffer + offset++) = cells_length;
00049       *(outbuffer + offset++) = 0;
00050       *(outbuffer + offset++) = 0;
00051       *(outbuffer + offset++) = 0;
00052       for( uint8_t i = 0; i < cells_length; i++){
00053       offset += this->cells[i].serialize(outbuffer + offset);
00054       }
00055       return offset;
00056     }
00057 
00058     virtual int deserialize(unsigned char *inbuffer)
00059     {
00060       int offset = 0;
00061       offset += this->header.deserialize(inbuffer + offset);
00062       union {
00063         float real;
00064         uint32_t base;
00065       } u_cell_width;
00066       u_cell_width.base = 0;
00067       u_cell_width.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00068       u_cell_width.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00069       u_cell_width.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00070       u_cell_width.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00071       this->cell_width = u_cell_width.real;
00072       offset += sizeof(this->cell_width);
00073       union {
00074         float real;
00075         uint32_t base;
00076       } u_cell_height;
00077       u_cell_height.base = 0;
00078       u_cell_height.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00079       u_cell_height.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00080       u_cell_height.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00081       u_cell_height.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00082       this->cell_height = u_cell_height.real;
00083       offset += sizeof(this->cell_height);
00084       uint8_t cells_lengthT = *(inbuffer + offset++);
00085       if(cells_lengthT > cells_length)
00086         this->cells = (geometry_msgs::Point*)realloc(this->cells, cells_lengthT * sizeof(geometry_msgs::Point));
00087       offset += 3;
00088       cells_length = cells_lengthT;
00089       for( uint8_t i = 0; i < cells_length; i++){
00090       offset += this->st_cells.deserialize(inbuffer + offset);
00091         memcpy( &(this->cells[i]), &(this->st_cells), sizeof(geometry_msgs::Point));
00092       }
00093      return offset;
00094     }
00095 
00096     const char * getType(){ return "nav_msgs/GridCells"; };
00097     const char * getMD5(){ return "b9e4f5df6d28e272ebde00a3994830f5"; };
00098 
00099   };
00100 
00101 }
00102 #endif


ric_mc
Author(s): RoboTiCan
autogenerated on Fri May 20 2016 03:48:55