Range.h
Go to the documentation of this file.
00001 #ifndef ros_sensor_msgs_Range_h
00002 #define ros_sensor_msgs_Range_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "../ros/msg.h"
00008 #include "std_msgs/Header.h"
00009 
00010 namespace sensor_msgs
00011 {
00012 
00013   class Range : public ros::Msg
00014   {
00015     public:
00016       std_msgs::Header header;
00017       unsigned char radiation_type;
00018       float field_of_view;
00019       float min_range;
00020       float max_range;
00021       float range;
00022       enum { ULTRASOUND = 0 };
00023       enum { INFRARED = 1 };
00024 
00025     virtual int serialize(unsigned char *outbuffer)
00026     {
00027       int offset = 0;
00028       offset += this->header.serialize(outbuffer + offset);
00029       union {
00030         unsigned char real;
00031         unsigned char base;
00032       } u_radiation_type;
00033       u_radiation_type.real = this->radiation_type;
00034       *(outbuffer + offset + 0) = (u_radiation_type.base >> (8 * 0)) & 0xFF;
00035       offset += sizeof(this->radiation_type);
00036       union {
00037         float real;
00038         unsigned long base;
00039       } u_field_of_view;
00040       u_field_of_view.real = this->field_of_view;
00041       *(outbuffer + offset + 0) = (u_field_of_view.base >> (8 * 0)) & 0xFF;
00042       *(outbuffer + offset + 1) = (u_field_of_view.base >> (8 * 1)) & 0xFF;
00043       *(outbuffer + offset + 2) = (u_field_of_view.base >> (8 * 2)) & 0xFF;
00044       *(outbuffer + offset + 3) = (u_field_of_view.base >> (8 * 3)) & 0xFF;
00045       offset += sizeof(this->field_of_view);
00046       union {
00047         float real;
00048         unsigned long base;
00049       } u_min_range;
00050       u_min_range.real = this->min_range;
00051       *(outbuffer + offset + 0) = (u_min_range.base >> (8 * 0)) & 0xFF;
00052       *(outbuffer + offset + 1) = (u_min_range.base >> (8 * 1)) & 0xFF;
00053       *(outbuffer + offset + 2) = (u_min_range.base >> (8 * 2)) & 0xFF;
00054       *(outbuffer + offset + 3) = (u_min_range.base >> (8 * 3)) & 0xFF;
00055       offset += sizeof(this->min_range);
00056       union {
00057         float real;
00058         unsigned long base;
00059       } u_max_range;
00060       u_max_range.real = this->max_range;
00061       *(outbuffer + offset + 0) = (u_max_range.base >> (8 * 0)) & 0xFF;
00062       *(outbuffer + offset + 1) = (u_max_range.base >> (8 * 1)) & 0xFF;
00063       *(outbuffer + offset + 2) = (u_max_range.base >> (8 * 2)) & 0xFF;
00064       *(outbuffer + offset + 3) = (u_max_range.base >> (8 * 3)) & 0xFF;
00065       offset += sizeof(this->max_range);
00066       union {
00067         float real;
00068         unsigned long base;
00069       } u_range;
00070       u_range.real = this->range;
00071       *(outbuffer + offset + 0) = (u_range.base >> (8 * 0)) & 0xFF;
00072       *(outbuffer + offset + 1) = (u_range.base >> (8 * 1)) & 0xFF;
00073       *(outbuffer + offset + 2) = (u_range.base >> (8 * 2)) & 0xFF;
00074       *(outbuffer + offset + 3) = (u_range.base >> (8 * 3)) & 0xFF;
00075       offset += sizeof(this->range);
00076       return offset;
00077     }
00078 
00079     virtual int deserialize(unsigned char *inbuffer)
00080     {
00081       int offset = 0;
00082       offset += this->header.deserialize(inbuffer + offset);
00083       union {
00084         unsigned char real;
00085         unsigned char base;
00086       } u_radiation_type;
00087       u_radiation_type.base = 0;
00088       u_radiation_type.base |= ((typeof(u_radiation_type.base)) (*(inbuffer + offset + 0))) << (8 * 0);
00089       this->radiation_type = u_radiation_type.real;
00090       offset += sizeof(this->radiation_type);
00091       union {
00092         float real;
00093         unsigned long base;
00094       } u_field_of_view;
00095       u_field_of_view.base = 0;
00096       u_field_of_view.base |= ((typeof(u_field_of_view.base)) (*(inbuffer + offset + 0))) << (8 * 0);
00097       u_field_of_view.base |= ((typeof(u_field_of_view.base)) (*(inbuffer + offset + 1))) << (8 * 1);
00098       u_field_of_view.base |= ((typeof(u_field_of_view.base)) (*(inbuffer + offset + 2))) << (8 * 2);
00099       u_field_of_view.base |= ((typeof(u_field_of_view.base)) (*(inbuffer + offset + 3))) << (8 * 3);
00100       this->field_of_view = u_field_of_view.real;
00101       offset += sizeof(this->field_of_view);
00102       union {
00103         float real;
00104         unsigned long base;
00105       } u_min_range;
00106       u_min_range.base = 0;
00107       u_min_range.base |= ((typeof(u_min_range.base)) (*(inbuffer + offset + 0))) << (8 * 0);
00108       u_min_range.base |= ((typeof(u_min_range.base)) (*(inbuffer + offset + 1))) << (8 * 1);
00109       u_min_range.base |= ((typeof(u_min_range.base)) (*(inbuffer + offset + 2))) << (8 * 2);
00110       u_min_range.base |= ((typeof(u_min_range.base)) (*(inbuffer + offset + 3))) << (8 * 3);
00111       this->min_range = u_min_range.real;
00112       offset += sizeof(this->min_range);
00113       union {
00114         float real;
00115         unsigned long base;
00116       } u_max_range;
00117       u_max_range.base = 0;
00118       u_max_range.base |= ((typeof(u_max_range.base)) (*(inbuffer + offset + 0))) << (8 * 0);
00119       u_max_range.base |= ((typeof(u_max_range.base)) (*(inbuffer + offset + 1))) << (8 * 1);
00120       u_max_range.base |= ((typeof(u_max_range.base)) (*(inbuffer + offset + 2))) << (8 * 2);
00121       u_max_range.base |= ((typeof(u_max_range.base)) (*(inbuffer + offset + 3))) << (8 * 3);
00122       this->max_range = u_max_range.real;
00123       offset += sizeof(this->max_range);
00124       union {
00125         float real;
00126         unsigned long base;
00127       } u_range;
00128       u_range.base = 0;
00129       u_range.base |= ((typeof(u_range.base)) (*(inbuffer + offset + 0))) << (8 * 0);
00130       u_range.base |= ((typeof(u_range.base)) (*(inbuffer + offset + 1))) << (8 * 1);
00131       u_range.base |= ((typeof(u_range.base)) (*(inbuffer + offset + 2))) << (8 * 2);
00132       u_range.base |= ((typeof(u_range.base)) (*(inbuffer + offset + 3))) << (8 * 3);
00133       this->range = u_range.real;
00134       offset += sizeof(this->range);
00135      return offset;
00136     }
00137 
00138     const char * getType(){ return "sensor_msgs/Range"; };
00139 
00140   };
00141 
00142 }
00143 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


traxbot_robot
Author(s): André Gonçalves Araújo
autogenerated on Fri Feb 1 2013 13:21:12