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


ric_mc
Author(s): RoboTiCan
autogenerated on Thu Aug 27 2015 14:39:49