rosserial for Hydro

Dependencies:   MODSERIAL

Fork of rosserial_mbed_lib by nucho

Committer:
nucho
Date:
Fri Aug 19 09:06:30 2011 +0000
Revision:
0:77afd7560544
Child:
1:ff0ec969dad1

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nucho 0:77afd7560544 1 #ifndef ros_MapMetaData_h
nucho 0:77afd7560544 2 #define ros_MapMetaData_h
nucho 0:77afd7560544 3
nucho 0:77afd7560544 4 #include <stdint.h>
nucho 0:77afd7560544 5 #include <string.h>
nucho 0:77afd7560544 6 #include <stdlib.h>
nucho 0:77afd7560544 7 #include "../ros/msg.h"
nucho 0:77afd7560544 8 #include "ros/time.h"
nucho 0:77afd7560544 9 #include "geometry_msgs/Pose.h"
nucho 0:77afd7560544 10
nucho 0:77afd7560544 11 namespace nav_msgs
nucho 0:77afd7560544 12 {
nucho 0:77afd7560544 13
nucho 0:77afd7560544 14 class MapMetaData : public ros::Msg
nucho 0:77afd7560544 15 {
nucho 0:77afd7560544 16 public:
nucho 0:77afd7560544 17 ros::Time map_load_time;
nucho 0:77afd7560544 18 float resolution;
nucho 0:77afd7560544 19 unsigned long width;
nucho 0:77afd7560544 20 unsigned long height;
nucho 0:77afd7560544 21 geometry_msgs::Pose origin;
nucho 0:77afd7560544 22
nucho 0:77afd7560544 23 virtual int serialize(unsigned char *outbuffer)
nucho 0:77afd7560544 24 {
nucho 0:77afd7560544 25 int offset = 0;
nucho 0:77afd7560544 26 union {
nucho 0:77afd7560544 27 unsigned long real;
nucho 0:77afd7560544 28 unsigned long base;
nucho 0:77afd7560544 29 } u_sec;
nucho 0:77afd7560544 30 u_sec.real = this->map_load_time.sec;
nucho 0:77afd7560544 31 *(outbuffer + offset + 0) = (u_sec.base >> (8 * 0)) & 0xFF;
nucho 0:77afd7560544 32 *(outbuffer + offset + 1) = (u_sec.base >> (8 * 1)) & 0xFF;
nucho 0:77afd7560544 33 *(outbuffer + offset + 2) = (u_sec.base >> (8 * 2)) & 0xFF;
nucho 0:77afd7560544 34 *(outbuffer + offset + 3) = (u_sec.base >> (8 * 3)) & 0xFF;
nucho 0:77afd7560544 35 offset += sizeof(this->map_load_time.sec);
nucho 0:77afd7560544 36 union {
nucho 0:77afd7560544 37 unsigned long real;
nucho 0:77afd7560544 38 unsigned long base;
nucho 0:77afd7560544 39 } u_nsec;
nucho 0:77afd7560544 40 u_nsec.real = this->map_load_time.nsec;
nucho 0:77afd7560544 41 *(outbuffer + offset + 0) = (u_nsec.base >> (8 * 0)) & 0xFF;
nucho 0:77afd7560544 42 *(outbuffer + offset + 1) = (u_nsec.base >> (8 * 1)) & 0xFF;
nucho 0:77afd7560544 43 *(outbuffer + offset + 2) = (u_nsec.base >> (8 * 2)) & 0xFF;
nucho 0:77afd7560544 44 *(outbuffer + offset + 3) = (u_nsec.base >> (8 * 3)) & 0xFF;
nucho 0:77afd7560544 45 offset += sizeof(this->map_load_time.nsec);
nucho 0:77afd7560544 46 union {
nucho 0:77afd7560544 47 float real;
nucho 0:77afd7560544 48 unsigned long base;
nucho 0:77afd7560544 49 } u_resolution;
nucho 0:77afd7560544 50 u_resolution.real = this->resolution;
nucho 0:77afd7560544 51 *(outbuffer + offset + 0) = (u_resolution.base >> (8 * 0)) & 0xFF;
nucho 0:77afd7560544 52 *(outbuffer + offset + 1) = (u_resolution.base >> (8 * 1)) & 0xFF;
nucho 0:77afd7560544 53 *(outbuffer + offset + 2) = (u_resolution.base >> (8 * 2)) & 0xFF;
nucho 0:77afd7560544 54 *(outbuffer + offset + 3) = (u_resolution.base >> (8 * 3)) & 0xFF;
nucho 0:77afd7560544 55 offset += sizeof(this->resolution);
nucho 0:77afd7560544 56 union {
nucho 0:77afd7560544 57 unsigned long real;
nucho 0:77afd7560544 58 unsigned long base;
nucho 0:77afd7560544 59 } u_width;
nucho 0:77afd7560544 60 u_width.real = this->width;
nucho 0:77afd7560544 61 *(outbuffer + offset + 0) = (u_width.base >> (8 * 0)) & 0xFF;
nucho 0:77afd7560544 62 *(outbuffer + offset + 1) = (u_width.base >> (8 * 1)) & 0xFF;
nucho 0:77afd7560544 63 *(outbuffer + offset + 2) = (u_width.base >> (8 * 2)) & 0xFF;
nucho 0:77afd7560544 64 *(outbuffer + offset + 3) = (u_width.base >> (8 * 3)) & 0xFF;
nucho 0:77afd7560544 65 offset += sizeof(this->width);
nucho 0:77afd7560544 66 union {
nucho 0:77afd7560544 67 unsigned long real;
nucho 0:77afd7560544 68 unsigned long base;
nucho 0:77afd7560544 69 } u_height;
nucho 0:77afd7560544 70 u_height.real = this->height;
nucho 0:77afd7560544 71 *(outbuffer + offset + 0) = (u_height.base >> (8 * 0)) & 0xFF;
nucho 0:77afd7560544 72 *(outbuffer + offset + 1) = (u_height.base >> (8 * 1)) & 0xFF;
nucho 0:77afd7560544 73 *(outbuffer + offset + 2) = (u_height.base >> (8 * 2)) & 0xFF;
nucho 0:77afd7560544 74 *(outbuffer + offset + 3) = (u_height.base >> (8 * 3)) & 0xFF;
nucho 0:77afd7560544 75 offset += sizeof(this->height);
nucho 0:77afd7560544 76 offset += this->origin.serialize(outbuffer + offset);
nucho 0:77afd7560544 77 return offset;
nucho 0:77afd7560544 78 }
nucho 0:77afd7560544 79
nucho 0:77afd7560544 80 virtual int deserialize(unsigned char *inbuffer)
nucho 0:77afd7560544 81 {
nucho 0:77afd7560544 82 int offset = 0;
nucho 0:77afd7560544 83 union {
nucho 0:77afd7560544 84 unsigned long real;
nucho 0:77afd7560544 85 unsigned long base;
nucho 0:77afd7560544 86 } u_sec;
nucho 0:77afd7560544 87 u_sec.base = 0;
nucho 0:77afd7560544 88 u_sec.base |= ((typeof(u_sec.base)) (*(inbuffer + offset + 0))) << (8 * 0);
nucho 0:77afd7560544 89 u_sec.base |= ((typeof(u_sec.base)) (*(inbuffer + offset + 1))) << (8 * 1);
nucho 0:77afd7560544 90 u_sec.base |= ((typeof(u_sec.base)) (*(inbuffer + offset + 2))) << (8 * 2);
nucho 0:77afd7560544 91 u_sec.base |= ((typeof(u_sec.base)) (*(inbuffer + offset + 3))) << (8 * 3);
nucho 0:77afd7560544 92 this->map_load_time.sec = u_sec.real;
nucho 0:77afd7560544 93 offset += sizeof(this->map_load_time.sec);
nucho 0:77afd7560544 94 union {
nucho 0:77afd7560544 95 unsigned long real;
nucho 0:77afd7560544 96 unsigned long base;
nucho 0:77afd7560544 97 } u_nsec;
nucho 0:77afd7560544 98 u_nsec.base = 0;
nucho 0:77afd7560544 99 u_nsec.base |= ((typeof(u_nsec.base)) (*(inbuffer + offset + 0))) << (8 * 0);
nucho 0:77afd7560544 100 u_nsec.base |= ((typeof(u_nsec.base)) (*(inbuffer + offset + 1))) << (8 * 1);
nucho 0:77afd7560544 101 u_nsec.base |= ((typeof(u_nsec.base)) (*(inbuffer + offset + 2))) << (8 * 2);
nucho 0:77afd7560544 102 u_nsec.base |= ((typeof(u_nsec.base)) (*(inbuffer + offset + 3))) << (8 * 3);
nucho 0:77afd7560544 103 this->map_load_time.nsec = u_nsec.real;
nucho 0:77afd7560544 104 offset += sizeof(this->map_load_time.nsec);
nucho 0:77afd7560544 105 union {
nucho 0:77afd7560544 106 float real;
nucho 0:77afd7560544 107 unsigned long base;
nucho 0:77afd7560544 108 } u_resolution;
nucho 0:77afd7560544 109 u_resolution.base = 0;
nucho 0:77afd7560544 110 u_resolution.base |= ((typeof(u_resolution.base)) (*(inbuffer + offset + 0))) << (8 * 0);
nucho 0:77afd7560544 111 u_resolution.base |= ((typeof(u_resolution.base)) (*(inbuffer + offset + 1))) << (8 * 1);
nucho 0:77afd7560544 112 u_resolution.base |= ((typeof(u_resolution.base)) (*(inbuffer + offset + 2))) << (8 * 2);
nucho 0:77afd7560544 113 u_resolution.base |= ((typeof(u_resolution.base)) (*(inbuffer + offset + 3))) << (8 * 3);
nucho 0:77afd7560544 114 this->resolution = u_resolution.real;
nucho 0:77afd7560544 115 offset += sizeof(this->resolution);
nucho 0:77afd7560544 116 union {
nucho 0:77afd7560544 117 unsigned long real;
nucho 0:77afd7560544 118 unsigned long base;
nucho 0:77afd7560544 119 } u_width;
nucho 0:77afd7560544 120 u_width.base = 0;
nucho 0:77afd7560544 121 u_width.base |= ((typeof(u_width.base)) (*(inbuffer + offset + 0))) << (8 * 0);
nucho 0:77afd7560544 122 u_width.base |= ((typeof(u_width.base)) (*(inbuffer + offset + 1))) << (8 * 1);
nucho 0:77afd7560544 123 u_width.base |= ((typeof(u_width.base)) (*(inbuffer + offset + 2))) << (8 * 2);
nucho 0:77afd7560544 124 u_width.base |= ((typeof(u_width.base)) (*(inbuffer + offset + 3))) << (8 * 3);
nucho 0:77afd7560544 125 this->width = u_width.real;
nucho 0:77afd7560544 126 offset += sizeof(this->width);
nucho 0:77afd7560544 127 union {
nucho 0:77afd7560544 128 unsigned long real;
nucho 0:77afd7560544 129 unsigned long base;
nucho 0:77afd7560544 130 } u_height;
nucho 0:77afd7560544 131 u_height.base = 0;
nucho 0:77afd7560544 132 u_height.base |= ((typeof(u_height.base)) (*(inbuffer + offset + 0))) << (8 * 0);
nucho 0:77afd7560544 133 u_height.base |= ((typeof(u_height.base)) (*(inbuffer + offset + 1))) << (8 * 1);
nucho 0:77afd7560544 134 u_height.base |= ((typeof(u_height.base)) (*(inbuffer + offset + 2))) << (8 * 2);
nucho 0:77afd7560544 135 u_height.base |= ((typeof(u_height.base)) (*(inbuffer + offset + 3))) << (8 * 3);
nucho 0:77afd7560544 136 this->height = u_height.real;
nucho 0:77afd7560544 137 offset += sizeof(this->height);
nucho 0:77afd7560544 138 offset += this->origin.deserialize(inbuffer + offset);
nucho 0:77afd7560544 139 return offset;
nucho 0:77afd7560544 140 }
nucho 0:77afd7560544 141
nucho 0:77afd7560544 142 virtual const char * getType(){ return "nav_msgs/MapMetaData"; };
nucho 0:77afd7560544 143
nucho 0:77afd7560544 144 };
nucho 0:77afd7560544 145
nucho 0:77afd7560544 146 }
nucho 0:77afd7560544 147 #endif