Go to the documentation of this file.00001 #ifndef _ROS_moveit_msgs_LinkPadding_h
00002 #define _ROS_moveit_msgs_LinkPadding_h
00003
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008
00009 namespace moveit_msgs
00010 {
00011
00012 class LinkPadding : public ros::Msg
00013 {
00014 public:
00015 const char* link_name;
00016 float padding;
00017
00018 virtual int serialize(unsigned char *outbuffer) const
00019 {
00020 int offset = 0;
00021 uint32_t length_link_name = strlen(this->link_name);
00022 memcpy(outbuffer + offset, &length_link_name, sizeof(uint32_t));
00023 offset += 4;
00024 memcpy(outbuffer + offset, this->link_name, length_link_name);
00025 offset += length_link_name;
00026 int32_t * val_padding = (int32_t *) &(this->padding);
00027 int32_t exp_padding = (((*val_padding)>>23)&255);
00028 if(exp_padding != 0)
00029 exp_padding += 1023-127;
00030 int32_t sig_padding = *val_padding;
00031 *(outbuffer + offset++) = 0;
00032 *(outbuffer + offset++) = 0;
00033 *(outbuffer + offset++) = 0;
00034 *(outbuffer + offset++) = (sig_padding<<5) & 0xff;
00035 *(outbuffer + offset++) = (sig_padding>>3) & 0xff;
00036 *(outbuffer + offset++) = (sig_padding>>11) & 0xff;
00037 *(outbuffer + offset++) = ((exp_padding<<4) & 0xF0) | ((sig_padding>>19)&0x0F);
00038 *(outbuffer + offset++) = (exp_padding>>4) & 0x7F;
00039 if(this->padding < 0) *(outbuffer + offset -1) |= 0x80;
00040 return offset;
00041 }
00042
00043 virtual int deserialize(unsigned char *inbuffer)
00044 {
00045 int offset = 0;
00046 uint32_t length_link_name;
00047 memcpy(&length_link_name, (inbuffer + offset), sizeof(uint32_t));
00048 offset += 4;
00049 for(unsigned int k= offset; k< offset+length_link_name; ++k){
00050 inbuffer[k-1]=inbuffer[k];
00051 }
00052 inbuffer[offset+length_link_name-1]=0;
00053 this->link_name = (char *)(inbuffer + offset-1);
00054 offset += length_link_name;
00055 uint32_t * val_padding = (uint32_t*) &(this->padding);
00056 offset += 3;
00057 *val_padding = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00058 *val_padding |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00059 *val_padding |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00060 *val_padding |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00061 uint32_t exp_padding = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00062 exp_padding |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00063 if(exp_padding !=0)
00064 *val_padding |= ((exp_padding)-1023+127)<<23;
00065 if( ((*(inbuffer+offset++)) & 0x80) > 0) this->padding = -this->padding;
00066 return offset;
00067 }
00068
00069 const char * getType(){ return "moveit_msgs/LinkPadding"; };
00070 const char * getMD5(){ return "b3ea75670df55c696fedee97774d5947"; };
00071
00072 };
00073
00074 }
00075 #endif