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 ProjectedMapInfo.h Source File

ProjectedMapInfo.h

00001 #ifndef _ROS_map_msgs_ProjectedMapInfo_h
00002 #define _ROS_map_msgs_ProjectedMapInfo_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace map_msgs
00010 {
00011 
00012   class ProjectedMapInfo : public ros::Msg
00013   {
00014     public:
00015       typedef const char* _frame_id_type;
00016       _frame_id_type frame_id;
00017       typedef double _x_type;
00018       _x_type x;
00019       typedef double _y_type;
00020       _y_type y;
00021       typedef double _width_type;
00022       _width_type width;
00023       typedef double _height_type;
00024       _height_type height;
00025       typedef double _min_z_type;
00026       _min_z_type min_z;
00027       typedef double _max_z_type;
00028       _max_z_type max_z;
00029 
00030     ProjectedMapInfo():
00031       frame_id(""),
00032       x(0),
00033       y(0),
00034       width(0),
00035       height(0),
00036       min_z(0),
00037       max_z(0)
00038     {
00039     }
00040 
00041     virtual int serialize(unsigned char *outbuffer) const
00042     {
00043       int offset = 0;
00044       uint32_t length_frame_id = strlen(this->frame_id);
00045       varToArr(outbuffer + offset, length_frame_id);
00046       offset += 4;
00047       memcpy(outbuffer + offset, this->frame_id, length_frame_id);
00048       offset += length_frame_id;
00049       union {
00050         double real;
00051         uint64_t base;
00052       } u_x;
00053       u_x.real = this->x;
00054       *(outbuffer + offset + 0) = (u_x.base >> (8 * 0)) & 0xFF;
00055       *(outbuffer + offset + 1) = (u_x.base >> (8 * 1)) & 0xFF;
00056       *(outbuffer + offset + 2) = (u_x.base >> (8 * 2)) & 0xFF;
00057       *(outbuffer + offset + 3) = (u_x.base >> (8 * 3)) & 0xFF;
00058       *(outbuffer + offset + 4) = (u_x.base >> (8 * 4)) & 0xFF;
00059       *(outbuffer + offset + 5) = (u_x.base >> (8 * 5)) & 0xFF;
00060       *(outbuffer + offset + 6) = (u_x.base >> (8 * 6)) & 0xFF;
00061       *(outbuffer + offset + 7) = (u_x.base >> (8 * 7)) & 0xFF;
00062       offset += sizeof(this->x);
00063       union {
00064         double real;
00065         uint64_t base;
00066       } u_y;
00067       u_y.real = this->y;
00068       *(outbuffer + offset + 0) = (u_y.base >> (8 * 0)) & 0xFF;
00069       *(outbuffer + offset + 1) = (u_y.base >> (8 * 1)) & 0xFF;
00070       *(outbuffer + offset + 2) = (u_y.base >> (8 * 2)) & 0xFF;
00071       *(outbuffer + offset + 3) = (u_y.base >> (8 * 3)) & 0xFF;
00072       *(outbuffer + offset + 4) = (u_y.base >> (8 * 4)) & 0xFF;
00073       *(outbuffer + offset + 5) = (u_y.base >> (8 * 5)) & 0xFF;
00074       *(outbuffer + offset + 6) = (u_y.base >> (8 * 6)) & 0xFF;
00075       *(outbuffer + offset + 7) = (u_y.base >> (8 * 7)) & 0xFF;
00076       offset += sizeof(this->y);
00077       union {
00078         double real;
00079         uint64_t base;
00080       } u_width;
00081       u_width.real = this->width;
00082       *(outbuffer + offset + 0) = (u_width.base >> (8 * 0)) & 0xFF;
00083       *(outbuffer + offset + 1) = (u_width.base >> (8 * 1)) & 0xFF;
00084       *(outbuffer + offset + 2) = (u_width.base >> (8 * 2)) & 0xFF;
00085       *(outbuffer + offset + 3) = (u_width.base >> (8 * 3)) & 0xFF;
00086       *(outbuffer + offset + 4) = (u_width.base >> (8 * 4)) & 0xFF;
00087       *(outbuffer + offset + 5) = (u_width.base >> (8 * 5)) & 0xFF;
00088       *(outbuffer + offset + 6) = (u_width.base >> (8 * 6)) & 0xFF;
00089       *(outbuffer + offset + 7) = (u_width.base >> (8 * 7)) & 0xFF;
00090       offset += sizeof(this->width);
00091       union {
00092         double real;
00093         uint64_t base;
00094       } u_height;
00095       u_height.real = this->height;
00096       *(outbuffer + offset + 0) = (u_height.base >> (8 * 0)) & 0xFF;
00097       *(outbuffer + offset + 1) = (u_height.base >> (8 * 1)) & 0xFF;
00098       *(outbuffer + offset + 2) = (u_height.base >> (8 * 2)) & 0xFF;
00099       *(outbuffer + offset + 3) = (u_height.base >> (8 * 3)) & 0xFF;
00100       *(outbuffer + offset + 4) = (u_height.base >> (8 * 4)) & 0xFF;
00101       *(outbuffer + offset + 5) = (u_height.base >> (8 * 5)) & 0xFF;
00102       *(outbuffer + offset + 6) = (u_height.base >> (8 * 6)) & 0xFF;
00103       *(outbuffer + offset + 7) = (u_height.base >> (8 * 7)) & 0xFF;
00104       offset += sizeof(this->height);
00105       union {
00106         double real;
00107         uint64_t base;
00108       } u_min_z;
00109       u_min_z.real = this->min_z;
00110       *(outbuffer + offset + 0) = (u_min_z.base >> (8 * 0)) & 0xFF;
00111       *(outbuffer + offset + 1) = (u_min_z.base >> (8 * 1)) & 0xFF;
00112       *(outbuffer + offset + 2) = (u_min_z.base >> (8 * 2)) & 0xFF;
00113       *(outbuffer + offset + 3) = (u_min_z.base >> (8 * 3)) & 0xFF;
00114       *(outbuffer + offset + 4) = (u_min_z.base >> (8 * 4)) & 0xFF;
00115       *(outbuffer + offset + 5) = (u_min_z.base >> (8 * 5)) & 0xFF;
00116       *(outbuffer + offset + 6) = (u_min_z.base >> (8 * 6)) & 0xFF;
00117       *(outbuffer + offset + 7) = (u_min_z.base >> (8 * 7)) & 0xFF;
00118       offset += sizeof(this->min_z);
00119       union {
00120         double real;
00121         uint64_t base;
00122       } u_max_z;
00123       u_max_z.real = this->max_z;
00124       *(outbuffer + offset + 0) = (u_max_z.base >> (8 * 0)) & 0xFF;
00125       *(outbuffer + offset + 1) = (u_max_z.base >> (8 * 1)) & 0xFF;
00126       *(outbuffer + offset + 2) = (u_max_z.base >> (8 * 2)) & 0xFF;
00127       *(outbuffer + offset + 3) = (u_max_z.base >> (8 * 3)) & 0xFF;
00128       *(outbuffer + offset + 4) = (u_max_z.base >> (8 * 4)) & 0xFF;
00129       *(outbuffer + offset + 5) = (u_max_z.base >> (8 * 5)) & 0xFF;
00130       *(outbuffer + offset + 6) = (u_max_z.base >> (8 * 6)) & 0xFF;
00131       *(outbuffer + offset + 7) = (u_max_z.base >> (8 * 7)) & 0xFF;
00132       offset += sizeof(this->max_z);
00133       return offset;
00134     }
00135 
00136     virtual int deserialize(unsigned char *inbuffer)
00137     {
00138       int offset = 0;
00139       uint32_t length_frame_id;
00140       arrToVar(length_frame_id, (inbuffer + offset));
00141       offset += 4;
00142       for(unsigned int k= offset; k< offset+length_frame_id; ++k){
00143           inbuffer[k-1]=inbuffer[k];
00144       }
00145       inbuffer[offset+length_frame_id-1]=0;
00146       this->frame_id = (char *)(inbuffer + offset-1);
00147       offset += length_frame_id;
00148       union {
00149         double real;
00150         uint64_t base;
00151       } u_x;
00152       u_x.base = 0;
00153       u_x.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00154       u_x.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00155       u_x.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00156       u_x.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00157       u_x.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00158       u_x.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00159       u_x.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00160       u_x.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00161       this->x = u_x.real;
00162       offset += sizeof(this->x);
00163       union {
00164         double real;
00165         uint64_t base;
00166       } u_y;
00167       u_y.base = 0;
00168       u_y.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00169       u_y.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00170       u_y.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00171       u_y.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00172       u_y.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00173       u_y.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00174       u_y.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00175       u_y.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00176       this->y = u_y.real;
00177       offset += sizeof(this->y);
00178       union {
00179         double real;
00180         uint64_t base;
00181       } u_width;
00182       u_width.base = 0;
00183       u_width.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00184       u_width.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00185       u_width.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00186       u_width.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00187       u_width.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00188       u_width.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00189       u_width.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00190       u_width.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00191       this->width = u_width.real;
00192       offset += sizeof(this->width);
00193       union {
00194         double real;
00195         uint64_t base;
00196       } u_height;
00197       u_height.base = 0;
00198       u_height.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00199       u_height.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00200       u_height.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00201       u_height.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00202       u_height.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00203       u_height.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00204       u_height.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00205       u_height.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00206       this->height = u_height.real;
00207       offset += sizeof(this->height);
00208       union {
00209         double real;
00210         uint64_t base;
00211       } u_min_z;
00212       u_min_z.base = 0;
00213       u_min_z.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00214       u_min_z.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00215       u_min_z.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00216       u_min_z.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00217       u_min_z.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00218       u_min_z.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00219       u_min_z.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00220       u_min_z.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00221       this->min_z = u_min_z.real;
00222       offset += sizeof(this->min_z);
00223       union {
00224         double real;
00225         uint64_t base;
00226       } u_max_z;
00227       u_max_z.base = 0;
00228       u_max_z.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00229       u_max_z.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00230       u_max_z.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00231       u_max_z.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00232       u_max_z.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00233       u_max_z.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00234       u_max_z.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00235       u_max_z.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00236       this->max_z = u_max_z.real;
00237       offset += sizeof(this->max_z);
00238      return offset;
00239     }
00240 
00241     const char * getType(){ return "map_msgs/ProjectedMapInfo"; };
00242     const char * getMD5(){ return "2dc10595ae94de23f22f8a6d2a0eef7a"; };
00243 
00244   };
00245 
00246 }
00247 #endif