This program is porting rosserial_arduino for mbed http://www.ros.org/wiki/rosserial_arduino This program supported the revision of 169 of rosserial.
Dependents: rosserial_mbed robot_S2
Diff: nav_msgs/MapMetaData.h
- Revision:
- 3:1cf99502f396
- Parent:
- 1:ff0ec969dad1
- Child:
- 4:684f39d0c346
diff -r bb6bb835fde4 -r 1cf99502f396 nav_msgs/MapMetaData.h --- a/nav_msgs/MapMetaData.h Sun Oct 16 09:35:11 2011 +0000 +++ b/nav_msgs/MapMetaData.h Sat Nov 12 23:54:45 2011 +0000 @@ -1,10 +1,10 @@ -#ifndef ros_nav_msgs_MapMetaData_h -#define ros_nav_msgs_MapMetaData_h +#ifndef _ROS_nav_msgs_MapMetaData_h +#define _ROS_nav_msgs_MapMetaData_h #include <stdint.h> #include <string.h> #include <stdlib.h> -#include "../ros/msg.h" +#include "ros/msg.h" #include "ros/time.h" #include "geometry_msgs/Pose.h" @@ -16,36 +16,26 @@ public: ros::Time map_load_time; float resolution; - unsigned long width; - unsigned long height; + uint32_t width; + uint32_t height; geometry_msgs::Pose origin; - virtual int serialize(unsigned char *outbuffer) + virtual int serialize(unsigned char *outbuffer) const { int offset = 0; - union { - unsigned long real; - unsigned long base; - } u_sec; - u_sec.real = this->map_load_time.sec; - *(outbuffer + offset + 0) = (u_sec.base >> (8 * 0)) & 0xFF; - *(outbuffer + offset + 1) = (u_sec.base >> (8 * 1)) & 0xFF; - *(outbuffer + offset + 2) = (u_sec.base >> (8 * 2)) & 0xFF; - *(outbuffer + offset + 3) = (u_sec.base >> (8 * 3)) & 0xFF; + *(outbuffer + offset + 0) = (this->map_load_time.sec >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (this->map_load_time.sec >> (8 * 1)) & 0xFF; + *(outbuffer + offset + 2) = (this->map_load_time.sec >> (8 * 2)) & 0xFF; + *(outbuffer + offset + 3) = (this->map_load_time.sec >> (8 * 3)) & 0xFF; offset += sizeof(this->map_load_time.sec); - union { - unsigned long real; - unsigned long base; - } u_nsec; - u_nsec.real = this->map_load_time.nsec; - *(outbuffer + offset + 0) = (u_nsec.base >> (8 * 0)) & 0xFF; - *(outbuffer + offset + 1) = (u_nsec.base >> (8 * 1)) & 0xFF; - *(outbuffer + offset + 2) = (u_nsec.base >> (8 * 2)) & 0xFF; - *(outbuffer + offset + 3) = (u_nsec.base >> (8 * 3)) & 0xFF; + *(outbuffer + offset + 0) = (this->map_load_time.nsec >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (this->map_load_time.nsec >> (8 * 1)) & 0xFF; + *(outbuffer + offset + 2) = (this->map_load_time.nsec >> (8 * 2)) & 0xFF; + *(outbuffer + offset + 3) = (this->map_load_time.nsec >> (8 * 3)) & 0xFF; offset += sizeof(this->map_load_time.nsec); union { float real; - unsigned long base; + uint32_t base; } u_resolution; u_resolution.real = this->resolution; *(outbuffer + offset + 0) = (u_resolution.base >> (8 * 0)) & 0xFF; @@ -53,25 +43,15 @@ *(outbuffer + offset + 2) = (u_resolution.base >> (8 * 2)) & 0xFF; *(outbuffer + offset + 3) = (u_resolution.base >> (8 * 3)) & 0xFF; offset += sizeof(this->resolution); - union { - unsigned long real; - unsigned long base; - } u_width; - u_width.real = this->width; - *(outbuffer + offset + 0) = (u_width.base >> (8 * 0)) & 0xFF; - *(outbuffer + offset + 1) = (u_width.base >> (8 * 1)) & 0xFF; - *(outbuffer + offset + 2) = (u_width.base >> (8 * 2)) & 0xFF; - *(outbuffer + offset + 3) = (u_width.base >> (8 * 3)) & 0xFF; + *(outbuffer + offset + 0) = (this->width >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (this->width >> (8 * 1)) & 0xFF; + *(outbuffer + offset + 2) = (this->width >> (8 * 2)) & 0xFF; + *(outbuffer + offset + 3) = (this->width >> (8 * 3)) & 0xFF; offset += sizeof(this->width); - union { - unsigned long real; - unsigned long base; - } u_height; - u_height.real = this->height; - *(outbuffer + offset + 0) = (u_height.base >> (8 * 0)) & 0xFF; - *(outbuffer + offset + 1) = (u_height.base >> (8 * 1)) & 0xFF; - *(outbuffer + offset + 2) = (u_height.base >> (8 * 2)) & 0xFF; - *(outbuffer + offset + 3) = (u_height.base >> (8 * 3)) & 0xFF; + *(outbuffer + offset + 0) = (this->height >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (this->height >> (8 * 1)) & 0xFF; + *(outbuffer + offset + 2) = (this->height >> (8 * 2)) & 0xFF; + *(outbuffer + offset + 3) = (this->height >> (8 * 3)) & 0xFF; offset += sizeof(this->height); offset += this->origin.serialize(outbuffer + offset); return offset; @@ -80,66 +60,43 @@ virtual int deserialize(unsigned char *inbuffer) { int offset = 0; - union { - unsigned long real; - unsigned long base; - } u_sec; - u_sec.base = 0; - u_sec.base |= ((typeof(u_sec.base)) (*(inbuffer + offset + 0))) << (8 * 0); - u_sec.base |= ((typeof(u_sec.base)) (*(inbuffer + offset + 1))) << (8 * 1); - u_sec.base |= ((typeof(u_sec.base)) (*(inbuffer + offset + 2))) << (8 * 2); - u_sec.base |= ((typeof(u_sec.base)) (*(inbuffer + offset + 3))) << (8 * 3); - this->map_load_time.sec = u_sec.real; + this->map_load_time.sec |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); + this->map_load_time.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); + this->map_load_time.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); + this->map_load_time.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); offset += sizeof(this->map_load_time.sec); - union { - unsigned long real; - unsigned long base; - } u_nsec; - u_nsec.base = 0; - u_nsec.base |= ((typeof(u_nsec.base)) (*(inbuffer + offset + 0))) << (8 * 0); - u_nsec.base |= ((typeof(u_nsec.base)) (*(inbuffer + offset + 1))) << (8 * 1); - u_nsec.base |= ((typeof(u_nsec.base)) (*(inbuffer + offset + 2))) << (8 * 2); - u_nsec.base |= ((typeof(u_nsec.base)) (*(inbuffer + offset + 3))) << (8 * 3); - this->map_load_time.nsec = u_nsec.real; + this->map_load_time.nsec |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); + this->map_load_time.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); + this->map_load_time.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); + this->map_load_time.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); offset += sizeof(this->map_load_time.nsec); union { float real; - unsigned long base; + uint32_t base; } u_resolution; u_resolution.base = 0; - u_resolution.base |= ((typeof(u_resolution.base)) (*(inbuffer + offset + 0))) << (8 * 0); - u_resolution.base |= ((typeof(u_resolution.base)) (*(inbuffer + offset + 1))) << (8 * 1); - u_resolution.base |= ((typeof(u_resolution.base)) (*(inbuffer + offset + 2))) << (8 * 2); - u_resolution.base |= ((typeof(u_resolution.base)) (*(inbuffer + offset + 3))) << (8 * 3); + u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); + u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); + u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); + u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); this->resolution = u_resolution.real; offset += sizeof(this->resolution); - union { - unsigned long real; - unsigned long base; - } u_width; - u_width.base = 0; - u_width.base |= ((typeof(u_width.base)) (*(inbuffer + offset + 0))) << (8 * 0); - u_width.base |= ((typeof(u_width.base)) (*(inbuffer + offset + 1))) << (8 * 1); - u_width.base |= ((typeof(u_width.base)) (*(inbuffer + offset + 2))) << (8 * 2); - u_width.base |= ((typeof(u_width.base)) (*(inbuffer + offset + 3))) << (8 * 3); - this->width = u_width.real; + this->width |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); + this->width |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); + this->width |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); + this->width |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); offset += sizeof(this->width); - union { - unsigned long real; - unsigned long base; - } u_height; - u_height.base = 0; - u_height.base |= ((typeof(u_height.base)) (*(inbuffer + offset + 0))) << (8 * 0); - u_height.base |= ((typeof(u_height.base)) (*(inbuffer + offset + 1))) << (8 * 1); - u_height.base |= ((typeof(u_height.base)) (*(inbuffer + offset + 2))) << (8 * 2); - u_height.base |= ((typeof(u_height.base)) (*(inbuffer + offset + 3))) << (8 * 3); - this->height = u_height.real; + this->height |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); + this->height |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); + this->height |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); + this->height |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); offset += sizeof(this->height); offset += this->origin.deserialize(inbuffer + offset); return offset; } - virtual const char * getType(){ return "nav_msgs/MapMetaData"; }; + virtual const char * getType(){ return "nav_msgs/MapMetaData"; }; + virtual const char * getMD5(){ return "10cfc8a2818024d3248802c00c95f11b"; }; };