Gary Servin / ros_lib_indigo

Dependencies:   BufferedSerial

Dependents:   rosserial_mbed_hello_world_publisher rtos_base_control rosserial_mbed_F64MA ROS-RTOS ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers RegionOfInterest.h Source File

RegionOfInterest.h

00001 #ifndef _ROS_sensor_msgs_RegionOfInterest_h
00002 #define _ROS_sensor_msgs_RegionOfInterest_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace sensor_msgs
00010 {
00011 
00012   class RegionOfInterest : public ros::Msg
00013   {
00014     public:
00015       uint32_t x_offset;
00016       uint32_t y_offset;
00017       uint32_t height;
00018       uint32_t width;
00019       bool do_rectify;
00020 
00021     RegionOfInterest():
00022       x_offset(0),
00023       y_offset(0),
00024       height(0),
00025       width(0),
00026       do_rectify(0)
00027     {
00028     }
00029 
00030     virtual int serialize(unsigned char *outbuffer) const
00031     {
00032       int offset = 0;
00033       *(outbuffer + offset + 0) = (this->x_offset >> (8 * 0)) & 0xFF;
00034       *(outbuffer + offset + 1) = (this->x_offset >> (8 * 1)) & 0xFF;
00035       *(outbuffer + offset + 2) = (this->x_offset >> (8 * 2)) & 0xFF;
00036       *(outbuffer + offset + 3) = (this->x_offset >> (8 * 3)) & 0xFF;
00037       offset += sizeof(this->x_offset);
00038       *(outbuffer + offset + 0) = (this->y_offset >> (8 * 0)) & 0xFF;
00039       *(outbuffer + offset + 1) = (this->y_offset >> (8 * 1)) & 0xFF;
00040       *(outbuffer + offset + 2) = (this->y_offset >> (8 * 2)) & 0xFF;
00041       *(outbuffer + offset + 3) = (this->y_offset >> (8 * 3)) & 0xFF;
00042       offset += sizeof(this->y_offset);
00043       *(outbuffer + offset + 0) = (this->height >> (8 * 0)) & 0xFF;
00044       *(outbuffer + offset + 1) = (this->height >> (8 * 1)) & 0xFF;
00045       *(outbuffer + offset + 2) = (this->height >> (8 * 2)) & 0xFF;
00046       *(outbuffer + offset + 3) = (this->height >> (8 * 3)) & 0xFF;
00047       offset += sizeof(this->height);
00048       *(outbuffer + offset + 0) = (this->width >> (8 * 0)) & 0xFF;
00049       *(outbuffer + offset + 1) = (this->width >> (8 * 1)) & 0xFF;
00050       *(outbuffer + offset + 2) = (this->width >> (8 * 2)) & 0xFF;
00051       *(outbuffer + offset + 3) = (this->width >> (8 * 3)) & 0xFF;
00052       offset += sizeof(this->width);
00053       union {
00054         bool real;
00055         uint8_t base;
00056       } u_do_rectify;
00057       u_do_rectify.real = this->do_rectify;
00058       *(outbuffer + offset + 0) = (u_do_rectify.base >> (8 * 0)) & 0xFF;
00059       offset += sizeof(this->do_rectify);
00060       return offset;
00061     }
00062 
00063     virtual int deserialize(unsigned char *inbuffer)
00064     {
00065       int offset = 0;
00066       this->x_offset =  ((uint32_t) (*(inbuffer + offset)));
00067       this->x_offset |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00068       this->x_offset |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00069       this->x_offset |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00070       offset += sizeof(this->x_offset);
00071       this->y_offset =  ((uint32_t) (*(inbuffer + offset)));
00072       this->y_offset |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00073       this->y_offset |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00074       this->y_offset |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00075       offset += sizeof(this->y_offset);
00076       this->height =  ((uint32_t) (*(inbuffer + offset)));
00077       this->height |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00078       this->height |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00079       this->height |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00080       offset += sizeof(this->height);
00081       this->width =  ((uint32_t) (*(inbuffer + offset)));
00082       this->width |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00083       this->width |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00084       this->width |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00085       offset += sizeof(this->width);
00086       union {
00087         bool real;
00088         uint8_t base;
00089       } u_do_rectify;
00090       u_do_rectify.base = 0;
00091       u_do_rectify.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00092       this->do_rectify = u_do_rectify.real;
00093       offset += sizeof(this->do_rectify);
00094      return offset;
00095     }
00096 
00097     const char * getType(){ return "sensor_msgs/RegionOfInterest"; };
00098     const char * getMD5(){ return "bdb633039d588fcccb441a4d43ccfe09"; };
00099 
00100   };
00101 
00102 }
00103 #endif