Go to the documentation of this file.00001 #ifndef _ROS_dynamic_reconfigure_Group_h
00002 #define _ROS_dynamic_reconfigure_Group_h
00003
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "dynamic_reconfigure/ParamDescription.h"
00009
00010 namespace dynamic_reconfigure
00011 {
00012
00013 class Group : public ros::Msg
00014 {
00015 public:
00016 char * name;
00017 char * type;
00018 uint8_t parameters_length;
00019 dynamic_reconfigure::ParamDescription st_parameters;
00020 dynamic_reconfigure::ParamDescription * parameters;
00021 int32_t parent;
00022 int32_t id;
00023
00024 virtual int serialize(unsigned char *outbuffer) const
00025 {
00026 int offset = 0;
00027 uint32_t length_name = strlen( (const char*) this->name);
00028 memcpy(outbuffer + offset, &length_name, sizeof(uint32_t));
00029 offset += 4;
00030 memcpy(outbuffer + offset, this->name, length_name);
00031 offset += length_name;
00032 uint32_t length_type = strlen( (const char*) this->type);
00033 memcpy(outbuffer + offset, &length_type, sizeof(uint32_t));
00034 offset += 4;
00035 memcpy(outbuffer + offset, this->type, length_type);
00036 offset += length_type;
00037 *(outbuffer + offset++) = parameters_length;
00038 *(outbuffer + offset++) = 0;
00039 *(outbuffer + offset++) = 0;
00040 *(outbuffer + offset++) = 0;
00041 for( uint8_t i = 0; i < parameters_length; i++){
00042 offset += this->parameters[i].serialize(outbuffer + offset);
00043 }
00044 union {
00045 int32_t real;
00046 uint32_t base;
00047 } u_parent;
00048 u_parent.real = this->parent;
00049 *(outbuffer + offset + 0) = (u_parent.base >> (8 * 0)) & 0xFF;
00050 *(outbuffer + offset + 1) = (u_parent.base >> (8 * 1)) & 0xFF;
00051 *(outbuffer + offset + 2) = (u_parent.base >> (8 * 2)) & 0xFF;
00052 *(outbuffer + offset + 3) = (u_parent.base >> (8 * 3)) & 0xFF;
00053 offset += sizeof(this->parent);
00054 union {
00055 int32_t real;
00056 uint32_t base;
00057 } u_id;
00058 u_id.real = this->id;
00059 *(outbuffer + offset + 0) = (u_id.base >> (8 * 0)) & 0xFF;
00060 *(outbuffer + offset + 1) = (u_id.base >> (8 * 1)) & 0xFF;
00061 *(outbuffer + offset + 2) = (u_id.base >> (8 * 2)) & 0xFF;
00062 *(outbuffer + offset + 3) = (u_id.base >> (8 * 3)) & 0xFF;
00063 offset += sizeof(this->id);
00064 return offset;
00065 }
00066
00067 virtual int deserialize(unsigned char *inbuffer)
00068 {
00069 int offset = 0;
00070 uint32_t length_name;
00071 memcpy(&length_name, (inbuffer + offset), sizeof(uint32_t));
00072 offset += 4;
00073 for(unsigned int k= offset; k< offset+length_name; ++k){
00074 inbuffer[k-1]=inbuffer[k];
00075 }
00076 inbuffer[offset+length_name-1]=0;
00077 this->name = (char *)(inbuffer + offset-1);
00078 offset += length_name;
00079 uint32_t length_type;
00080 memcpy(&length_type, (inbuffer + offset), sizeof(uint32_t));
00081 offset += 4;
00082 for(unsigned int k= offset; k< offset+length_type; ++k){
00083 inbuffer[k-1]=inbuffer[k];
00084 }
00085 inbuffer[offset+length_type-1]=0;
00086 this->type = (char *)(inbuffer + offset-1);
00087 offset += length_type;
00088 uint8_t parameters_lengthT = *(inbuffer + offset++);
00089 if(parameters_lengthT > parameters_length)
00090 this->parameters = (dynamic_reconfigure::ParamDescription*)realloc(this->parameters, parameters_lengthT * sizeof(dynamic_reconfigure::ParamDescription));
00091 offset += 3;
00092 parameters_length = parameters_lengthT;
00093 for( uint8_t i = 0; i < parameters_length; i++){
00094 offset += this->st_parameters.deserialize(inbuffer + offset);
00095 memcpy( &(this->parameters[i]), &(this->st_parameters), sizeof(dynamic_reconfigure::ParamDescription));
00096 }
00097 union {
00098 int32_t real;
00099 uint32_t base;
00100 } u_parent;
00101 u_parent.base = 0;
00102 u_parent.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00103 u_parent.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00104 u_parent.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00105 u_parent.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00106 this->parent = u_parent.real;
00107 offset += sizeof(this->parent);
00108 union {
00109 int32_t real;
00110 uint32_t base;
00111 } u_id;
00112 u_id.base = 0;
00113 u_id.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00114 u_id.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00115 u_id.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00116 u_id.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00117 this->id = u_id.real;
00118 offset += sizeof(this->id);
00119 return offset;
00120 }
00121
00122 const char * getType(){ return "dynamic_reconfigure/Group"; };
00123 const char * getMD5(){ return "9e8cd9e9423c94823db3614dd8b1cf7a"; };
00124
00125 };
00126
00127 }
00128 #endif