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


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