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)
00018     {
00019       int offset = 0;
00020       long * val_data = (long *) &(this->data);
00021       long exp_data = (((*val_data)>>23)&255);
00022       if(exp_data != 0)
00023         exp_data += 1023-127;
00024       long 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       unsigned long * val_data = (unsigned long*) &(this->data);
00041       offset += 3;
00042       *val_data = ((unsigned long)(*(inbuffer + offset++))>>5 & 0x07);
00043       *val_data |= ((unsigned long)(*(inbuffer + offset++)) & 0xff)<<3;
00044       *val_data |= ((unsigned long)(*(inbuffer + offset++)) & 0xff)<<11;
00045       *val_data |= ((unsigned long)(*(inbuffer + offset)) & 0x0f)<<19;
00046       unsigned long exp_data = ((unsigned long)(*(inbuffer + offset++))&0xf0)>>4;
00047       exp_data |= ((unsigned long)(*(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 
00056   };
00057 
00058 }
00059 #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