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 ParamDescription.h Source File

ParamDescription.h

00001 #ifndef _ROS_dynamic_reconfigure_ParamDescription_h
00002 #define _ROS_dynamic_reconfigure_ParamDescription_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 ParamDescription : public ros::Msg
00013   {
00014     public:
00015       typedef const char* _name_type;
00016       _name_type name;
00017       typedef const char* _type_type;
00018       _type_type type;
00019       typedef uint32_t _level_type;
00020       _level_type level;
00021       typedef const char* _description_type;
00022       _description_type description;
00023       typedef const char* _edit_method_type;
00024       _edit_method_type edit_method;
00025 
00026     ParamDescription():
00027       name(""),
00028       type(""),
00029       level(0),
00030       description(""),
00031       edit_method("")
00032     {
00033     }
00034 
00035     virtual int serialize(unsigned char *outbuffer) const
00036     {
00037       int offset = 0;
00038       uint32_t length_name = strlen(this->name);
00039       varToArr(outbuffer + offset, length_name);
00040       offset += 4;
00041       memcpy(outbuffer + offset, this->name, length_name);
00042       offset += length_name;
00043       uint32_t length_type = strlen(this->type);
00044       varToArr(outbuffer + offset, length_type);
00045       offset += 4;
00046       memcpy(outbuffer + offset, this->type, length_type);
00047       offset += length_type;
00048       *(outbuffer + offset + 0) = (this->level >> (8 * 0)) & 0xFF;
00049       *(outbuffer + offset + 1) = (this->level >> (8 * 1)) & 0xFF;
00050       *(outbuffer + offset + 2) = (this->level >> (8 * 2)) & 0xFF;
00051       *(outbuffer + offset + 3) = (this->level >> (8 * 3)) & 0xFF;
00052       offset += sizeof(this->level);
00053       uint32_t length_description = strlen(this->description);
00054       varToArr(outbuffer + offset, length_description);
00055       offset += 4;
00056       memcpy(outbuffer + offset, this->description, length_description);
00057       offset += length_description;
00058       uint32_t length_edit_method = strlen(this->edit_method);
00059       varToArr(outbuffer + offset, length_edit_method);
00060       offset += 4;
00061       memcpy(outbuffer + offset, this->edit_method, length_edit_method);
00062       offset += length_edit_method;
00063       return offset;
00064     }
00065 
00066     virtual int deserialize(unsigned char *inbuffer)
00067     {
00068       int offset = 0;
00069       uint32_t length_name;
00070       arrToVar(length_name, (inbuffer + offset));
00071       offset += 4;
00072       for(unsigned int k= offset; k< offset+length_name; ++k){
00073           inbuffer[k-1]=inbuffer[k];
00074       }
00075       inbuffer[offset+length_name-1]=0;
00076       this->name = (char *)(inbuffer + offset-1);
00077       offset += length_name;
00078       uint32_t length_type;
00079       arrToVar(length_type, (inbuffer + offset));
00080       offset += 4;
00081       for(unsigned int k= offset; k< offset+length_type; ++k){
00082           inbuffer[k-1]=inbuffer[k];
00083       }
00084       inbuffer[offset+length_type-1]=0;
00085       this->type = (char *)(inbuffer + offset-1);
00086       offset += length_type;
00087       this->level =  ((uint32_t) (*(inbuffer + offset)));
00088       this->level |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00089       this->level |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00090       this->level |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00091       offset += sizeof(this->level);
00092       uint32_t length_description;
00093       arrToVar(length_description, (inbuffer + offset));
00094       offset += 4;
00095       for(unsigned int k= offset; k< offset+length_description; ++k){
00096           inbuffer[k-1]=inbuffer[k];
00097       }
00098       inbuffer[offset+length_description-1]=0;
00099       this->description = (char *)(inbuffer + offset-1);
00100       offset += length_description;
00101       uint32_t length_edit_method;
00102       arrToVar(length_edit_method, (inbuffer + offset));
00103       offset += 4;
00104       for(unsigned int k= offset; k< offset+length_edit_method; ++k){
00105           inbuffer[k-1]=inbuffer[k];
00106       }
00107       inbuffer[offset+length_edit_method-1]=0;
00108       this->edit_method = (char *)(inbuffer + offset-1);
00109       offset += length_edit_method;
00110      return offset;
00111     }
00112 
00113     const char * getType(){ return "dynamic_reconfigure/ParamDescription"; };
00114     const char * getMD5(){ return "7434fcb9348c13054e0c3b267c8cb34d"; };
00115 
00116   };
00117 
00118 }
00119 #endif