Float64.h
Go to the documentation of this file.
00001 #ifndef _ROS_std_msgs_Float64_h
00002 #define _ROS_std_msgs_Float64_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace std_msgs
00010 {
00011 
00012   class Float64 : public ros::Msg
00013   {
00014     public:
00015       float data;
00016 
00017     virtual int serialize(unsigned char *outbuffer) const
00018     {
00019       int offset = 0;
00020       int32_t * val_data = (int32_t *) &(this->data);
00021       int32_t exp_data = (((*val_data)>>23)&255);
00022       if(exp_data != 0)
00023         exp_data += 1023-127;
00024       int32_t sig_data = *val_data;
00025       *(outbuffer + offset++) = 0;
00026       *(outbuffer + offset++) = 0;
00027       *(outbuffer + offset++) = 0;
00028       *(outbuffer + offset++) = (sig_data<<5) & 0xff;
00029       *(outbuffer + offset++) = (sig_data>>3) & 0xff;
00030       *(outbuffer + offset++) = (sig_data>>11) & 0xff;
00031       *(outbuffer + offset++) = ((exp_data<<4) & 0xF0) | ((sig_data>>19)&0x0F);
00032       *(outbuffer + offset++) = (exp_data>>4) & 0x7F;
00033       if(this->data < 0) *(outbuffer + offset -1) |= 0x80;
00034       return offset;
00035     }
00036 
00037     virtual int deserialize(unsigned char *inbuffer)
00038     {
00039       int offset = 0;
00040       uint32_t * val_data = (uint32_t*) &(this->data);
00041       offset += 3;
00042       *val_data = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00043       *val_data |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00044       *val_data |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00045       *val_data |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00046       uint32_t exp_data = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00047       exp_data |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00048       if(exp_data !=0)
00049         *val_data |= ((exp_data)-1023+127)<<23;
00050       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->data = -this->data;
00051      return offset;
00052     }
00053 
00054     const char * getType(){ return "std_msgs/Float64"; };
00055     const char * getMD5(){ return "fdb28210bfa9d7c91146260178d9a584"; };
00056 
00057   };
00058 
00059 }
00060 #endif


ric_mc
Author(s): RoboTiCan
autogenerated on Fri May 20 2016 03:48:55