Working towards recieving twists

Dependencies:   BufferedSerial

Fork of ros_lib_kinetic by Gary Servin

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers StrParameter.h Source File

StrParameter.h

00001 #ifndef _ROS_dynamic_reconfigure_StrParameter_h
00002 #define _ROS_dynamic_reconfigure_StrParameter_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 StrParameter : public ros::Msg
00013   {
00014     public:
00015       typedef const char* _name_type;
00016       _name_type name;
00017       typedef const char* _value_type;
00018       _value_type value;
00019 
00020     StrParameter():
00021       name(""),
00022       value("")
00023     {
00024     }
00025 
00026     virtual int serialize(unsigned char *outbuffer) const
00027     {
00028       int offset = 0;
00029       uint32_t length_name = strlen(this->name);
00030       varToArr(outbuffer + offset, length_name);
00031       offset += 4;
00032       memcpy(outbuffer + offset, this->name, length_name);
00033       offset += length_name;
00034       uint32_t length_value = strlen(this->value);
00035       varToArr(outbuffer + offset, length_value);
00036       offset += 4;
00037       memcpy(outbuffer + offset, this->value, length_value);
00038       offset += length_value;
00039       return offset;
00040     }
00041 
00042     virtual int deserialize(unsigned char *inbuffer)
00043     {
00044       int offset = 0;
00045       uint32_t length_name;
00046       arrToVar(length_name, (inbuffer + offset));
00047       offset += 4;
00048       for(unsigned int k= offset; k< offset+length_name; ++k){
00049           inbuffer[k-1]=inbuffer[k];
00050       }
00051       inbuffer[offset+length_name-1]=0;
00052       this->name = (char *)(inbuffer + offset-1);
00053       offset += length_name;
00054       uint32_t length_value;
00055       arrToVar(length_value, (inbuffer + offset));
00056       offset += 4;
00057       for(unsigned int k= offset; k< offset+length_value; ++k){
00058           inbuffer[k-1]=inbuffer[k];
00059       }
00060       inbuffer[offset+length_value-1]=0;
00061       this->value = (char *)(inbuffer + offset-1);
00062       offset += length_value;
00063      return offset;
00064     }
00065 
00066     const char * getType(){ return "dynamic_reconfigure/StrParameter"; };
00067     const char * getMD5(){ return "bc6ccc4a57f61779c8eaae61e9f422e0"; };
00068 
00069   };
00070 
00071 }
00072 #endif