Point.h
Go to the documentation of this file.
00001 #ifndef _ROS_geometry_msgs_Point_h
00002 #define _ROS_geometry_msgs_Point_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace geometry_msgs
00010 {
00011 
00012   class Point : public ros::Msg
00013   {
00014     public:
00015       float x;
00016       float y;
00017       float z;
00018 
00019     virtual int serialize(unsigned char *outbuffer) const
00020     {
00021       int offset = 0;
00022       int32_t * val_x = (int32_t *) &(this->x);
00023       int32_t exp_x = (((*val_x)>>23)&255);
00024       if(exp_x != 0)
00025         exp_x += 1023-127;
00026       int32_t sig_x = *val_x;
00027       *(outbuffer + offset++) = 0;
00028       *(outbuffer + offset++) = 0;
00029       *(outbuffer + offset++) = 0;
00030       *(outbuffer + offset++) = (sig_x<<5) & 0xff;
00031       *(outbuffer + offset++) = (sig_x>>3) & 0xff;
00032       *(outbuffer + offset++) = (sig_x>>11) & 0xff;
00033       *(outbuffer + offset++) = ((exp_x<<4) & 0xF0) | ((sig_x>>19)&0x0F);
00034       *(outbuffer + offset++) = (exp_x>>4) & 0x7F;
00035       if(this->x < 0) *(outbuffer + offset -1) |= 0x80;
00036       int32_t * val_y = (int32_t *) &(this->y);
00037       int32_t exp_y = (((*val_y)>>23)&255);
00038       if(exp_y != 0)
00039         exp_y += 1023-127;
00040       int32_t sig_y = *val_y;
00041       *(outbuffer + offset++) = 0;
00042       *(outbuffer + offset++) = 0;
00043       *(outbuffer + offset++) = 0;
00044       *(outbuffer + offset++) = (sig_y<<5) & 0xff;
00045       *(outbuffer + offset++) = (sig_y>>3) & 0xff;
00046       *(outbuffer + offset++) = (sig_y>>11) & 0xff;
00047       *(outbuffer + offset++) = ((exp_y<<4) & 0xF0) | ((sig_y>>19)&0x0F);
00048       *(outbuffer + offset++) = (exp_y>>4) & 0x7F;
00049       if(this->y < 0) *(outbuffer + offset -1) |= 0x80;
00050       int32_t * val_z = (int32_t *) &(this->z);
00051       int32_t exp_z = (((*val_z)>>23)&255);
00052       if(exp_z != 0)
00053         exp_z += 1023-127;
00054       int32_t sig_z = *val_z;
00055       *(outbuffer + offset++) = 0;
00056       *(outbuffer + offset++) = 0;
00057       *(outbuffer + offset++) = 0;
00058       *(outbuffer + offset++) = (sig_z<<5) & 0xff;
00059       *(outbuffer + offset++) = (sig_z>>3) & 0xff;
00060       *(outbuffer + offset++) = (sig_z>>11) & 0xff;
00061       *(outbuffer + offset++) = ((exp_z<<4) & 0xF0) | ((sig_z>>19)&0x0F);
00062       *(outbuffer + offset++) = (exp_z>>4) & 0x7F;
00063       if(this->z < 0) *(outbuffer + offset -1) |= 0x80;
00064       return offset;
00065     }
00066 
00067     virtual int deserialize(unsigned char *inbuffer)
00068     {
00069       int offset = 0;
00070       uint32_t * val_x = (uint32_t*) &(this->x);
00071       offset += 3;
00072       *val_x = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00073       *val_x |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00074       *val_x |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00075       *val_x |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00076       uint32_t exp_x = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00077       exp_x |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00078       if(exp_x !=0)
00079         *val_x |= ((exp_x)-1023+127)<<23;
00080       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->x = -this->x;
00081       uint32_t * val_y = (uint32_t*) &(this->y);
00082       offset += 3;
00083       *val_y = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00084       *val_y |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00085       *val_y |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00086       *val_y |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00087       uint32_t exp_y = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00088       exp_y |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00089       if(exp_y !=0)
00090         *val_y |= ((exp_y)-1023+127)<<23;
00091       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->y = -this->y;
00092       uint32_t * val_z = (uint32_t*) &(this->z);
00093       offset += 3;
00094       *val_z = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00095       *val_z |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00096       *val_z |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00097       *val_z |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00098       uint32_t exp_z = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00099       exp_z |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00100       if(exp_z !=0)
00101         *val_z |= ((exp_z)-1023+127)<<23;
00102       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->z = -this->z;
00103      return offset;
00104     }
00105 
00106     const char * getType(){ return "geometry_msgs/Point"; };
00107     const char * getMD5(){ return "4a842b65f413084dc2b10fb484ea7f17"; };
00108 
00109   };
00110 
00111 }
00112 #endif


lizi_arduino
Author(s): RoboTiCan
autogenerated on Wed Aug 26 2015 12:24:22