rosserial for Hydro

Dependencies:   MODSERIAL

Fork of rosserial_mbed_lib by nucho

Revision:
3:1cf99502f396
Parent:
0:77afd7560544
--- a/sensor_msgs/RegionOfInterest.h	Sun Oct 16 09:35:11 2011 +0000
+++ b/sensor_msgs/RegionOfInterest.h	Sat Nov 12 23:54:45 2011 +0000
@@ -1,10 +1,10 @@
-#ifndef ros_RegionOfInterest_h
-#define ros_RegionOfInterest_h
+#ifndef _ROS_sensor_msgs_RegionOfInterest_h
+#define _ROS_sensor_msgs_RegionOfInterest_h
 
 #include <stdint.h>
 #include <string.h>
 #include <stdlib.h>
-#include "../ros/msg.h"
+#include "ros/msg.h"
 
 namespace sensor_msgs
 {
@@ -12,58 +12,38 @@
   class RegionOfInterest : public ros::Msg
   {
     public:
-      unsigned long x_offset;
-      unsigned long y_offset;
-      unsigned long height;
-      unsigned long width;
+      uint32_t x_offset;
+      uint32_t y_offset;
+      uint32_t height;
+      uint32_t width;
       bool do_rectify;
 
-    virtual int serialize(unsigned char *outbuffer)
+    virtual int serialize(unsigned char *outbuffer) const
     {
       int offset = 0;
-      union {
-        unsigned long real;
-        unsigned long base;
-      } u_x_offset;
-      u_x_offset.real = this->x_offset;
-      *(outbuffer + offset + 0) = (u_x_offset.base >> (8 * 0)) & 0xFF;
-      *(outbuffer + offset + 1) = (u_x_offset.base >> (8 * 1)) & 0xFF;
-      *(outbuffer + offset + 2) = (u_x_offset.base >> (8 * 2)) & 0xFF;
-      *(outbuffer + offset + 3) = (u_x_offset.base >> (8 * 3)) & 0xFF;
+      *(outbuffer + offset + 0) = (this->x_offset >> (8 * 0)) & 0xFF;
+      *(outbuffer + offset + 1) = (this->x_offset >> (8 * 1)) & 0xFF;
+      *(outbuffer + offset + 2) = (this->x_offset >> (8 * 2)) & 0xFF;
+      *(outbuffer + offset + 3) = (this->x_offset >> (8 * 3)) & 0xFF;
       offset += sizeof(this->x_offset);
-      union {
-        unsigned long real;
-        unsigned long base;
-      } u_y_offset;
-      u_y_offset.real = this->y_offset;
-      *(outbuffer + offset + 0) = (u_y_offset.base >> (8 * 0)) & 0xFF;
-      *(outbuffer + offset + 1) = (u_y_offset.base >> (8 * 1)) & 0xFF;
-      *(outbuffer + offset + 2) = (u_y_offset.base >> (8 * 2)) & 0xFF;
-      *(outbuffer + offset + 3) = (u_y_offset.base >> (8 * 3)) & 0xFF;
+      *(outbuffer + offset + 0) = (this->y_offset >> (8 * 0)) & 0xFF;
+      *(outbuffer + offset + 1) = (this->y_offset >> (8 * 1)) & 0xFF;
+      *(outbuffer + offset + 2) = (this->y_offset >> (8 * 2)) & 0xFF;
+      *(outbuffer + offset + 3) = (this->y_offset >> (8 * 3)) & 0xFF;
       offset += sizeof(this->y_offset);
-      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);
-      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 {
         bool real;
-        unsigned char base;
+        uint8_t base;
       } u_do_rectify;
       u_do_rectify.real = this->do_rectify;
       *(outbuffer + offset + 0) = (u_do_rectify.base >> (8 * 0)) & 0xFF;
@@ -74,62 +54,39 @@
     virtual int deserialize(unsigned char *inbuffer)
     {
       int offset = 0;
-      union {
-        unsigned long real;
-        unsigned long base;
-      } u_x_offset;
-      u_x_offset.base = 0;
-      u_x_offset.base |= ((typeof(u_x_offset.base)) (*(inbuffer + offset + 0))) << (8 * 0);
-      u_x_offset.base |= ((typeof(u_x_offset.base)) (*(inbuffer + offset + 1))) << (8 * 1);
-      u_x_offset.base |= ((typeof(u_x_offset.base)) (*(inbuffer + offset + 2))) << (8 * 2);
-      u_x_offset.base |= ((typeof(u_x_offset.base)) (*(inbuffer + offset + 3))) << (8 * 3);
-      this->x_offset = u_x_offset.real;
+      this->x_offset |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
+      this->x_offset |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
+      this->x_offset |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
+      this->x_offset |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
       offset += sizeof(this->x_offset);
-      union {
-        unsigned long real;
-        unsigned long base;
-      } u_y_offset;
-      u_y_offset.base = 0;
-      u_y_offset.base |= ((typeof(u_y_offset.base)) (*(inbuffer + offset + 0))) << (8 * 0);
-      u_y_offset.base |= ((typeof(u_y_offset.base)) (*(inbuffer + offset + 1))) << (8 * 1);
-      u_y_offset.base |= ((typeof(u_y_offset.base)) (*(inbuffer + offset + 2))) << (8 * 2);
-      u_y_offset.base |= ((typeof(u_y_offset.base)) (*(inbuffer + offset + 3))) << (8 * 3);
-      this->y_offset = u_y_offset.real;
+      this->y_offset |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
+      this->y_offset |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
+      this->y_offset |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
+      this->y_offset |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
       offset += sizeof(this->y_offset);
-      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);
-      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 {
         bool real;
-        unsigned char base;
+        uint8_t base;
       } u_do_rectify;
       u_do_rectify.base = 0;
-      u_do_rectify.base |= ((typeof(u_do_rectify.base)) (*(inbuffer + offset + 0))) << (8 * 0);
+      u_do_rectify.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
       this->do_rectify = u_do_rectify.real;
       offset += sizeof(this->do_rectify);
      return offset;
     }
 
-   virtual const char * getType(){ return "sensor_msgs/RegionOfInterest"; };
+    virtual const char * getType(){ return "sensor_msgs/RegionOfInterest"; };
+    virtual const char * getMD5(){ return "bdb633039d588fcccb441a4d43ccfe09"; };
 
   };