ROS Serial library for Mbed platforms for ROS Indigo Igloo. Check http://wiki.ros.org/rosserial_mbed/ for more information
Dependents: rosserial_mbed_hello_world_publisher rtos_base_control rosserial_mbed_F64MA ROS-RTOS ... more
Group.h
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 const char* name; 00017 const 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 Group(): 00025 name(""), 00026 type(""), 00027 parameters_length(0), parameters(NULL), 00028 parent(0), 00029 id(0) 00030 { 00031 } 00032 00033 virtual int serialize(unsigned char *outbuffer) const 00034 { 00035 int offset = 0; 00036 uint32_t length_name = strlen(this->name); 00037 memcpy(outbuffer + offset, &length_name, sizeof(uint32_t)); 00038 offset += 4; 00039 memcpy(outbuffer + offset, this->name, length_name); 00040 offset += length_name; 00041 uint32_t length_type = strlen(this->type); 00042 memcpy(outbuffer + offset, &length_type, sizeof(uint32_t)); 00043 offset += 4; 00044 memcpy(outbuffer + offset, this->type, length_type); 00045 offset += length_type; 00046 *(outbuffer + offset++) = parameters_length; 00047 *(outbuffer + offset++) = 0; 00048 *(outbuffer + offset++) = 0; 00049 *(outbuffer + offset++) = 0; 00050 for( uint8_t i = 0; i < parameters_length; i++){ 00051 offset += this->parameters[i].serialize(outbuffer + offset); 00052 } 00053 union { 00054 int32_t real; 00055 uint32_t base; 00056 } u_parent; 00057 u_parent.real = this->parent; 00058 *(outbuffer + offset + 0) = (u_parent.base >> (8 * 0)) & 0xFF; 00059 *(outbuffer + offset + 1) = (u_parent.base >> (8 * 1)) & 0xFF; 00060 *(outbuffer + offset + 2) = (u_parent.base >> (8 * 2)) & 0xFF; 00061 *(outbuffer + offset + 3) = (u_parent.base >> (8 * 3)) & 0xFF; 00062 offset += sizeof(this->parent); 00063 union { 00064 int32_t real; 00065 uint32_t base; 00066 } u_id; 00067 u_id.real = this->id; 00068 *(outbuffer + offset + 0) = (u_id.base >> (8 * 0)) & 0xFF; 00069 *(outbuffer + offset + 1) = (u_id.base >> (8 * 1)) & 0xFF; 00070 *(outbuffer + offset + 2) = (u_id.base >> (8 * 2)) & 0xFF; 00071 *(outbuffer + offset + 3) = (u_id.base >> (8 * 3)) & 0xFF; 00072 offset += sizeof(this->id); 00073 return offset; 00074 } 00075 00076 virtual int deserialize(unsigned char *inbuffer) 00077 { 00078 int offset = 0; 00079 uint32_t length_name; 00080 memcpy(&length_name, (inbuffer + offset), sizeof(uint32_t)); 00081 offset += 4; 00082 for(unsigned int k= offset; k< offset+length_name; ++k){ 00083 inbuffer[k-1]=inbuffer[k]; 00084 } 00085 inbuffer[offset+length_name-1]=0; 00086 this->name = (char *)(inbuffer + offset-1); 00087 offset += length_name; 00088 uint32_t length_type; 00089 memcpy(&length_type, (inbuffer + offset), sizeof(uint32_t)); 00090 offset += 4; 00091 for(unsigned int k= offset; k< offset+length_type; ++k){ 00092 inbuffer[k-1]=inbuffer[k]; 00093 } 00094 inbuffer[offset+length_type-1]=0; 00095 this->type = (char *)(inbuffer + offset-1); 00096 offset += length_type; 00097 uint8_t parameters_lengthT = *(inbuffer + offset++); 00098 if(parameters_lengthT > parameters_length) 00099 this->parameters = (dynamic_reconfigure::ParamDescription*)realloc(this->parameters, parameters_lengthT * sizeof(dynamic_reconfigure::ParamDescription)); 00100 offset += 3; 00101 parameters_length = parameters_lengthT; 00102 for( uint8_t i = 0; i < parameters_length; i++){ 00103 offset += this->st_parameters.deserialize(inbuffer + offset); 00104 memcpy( &(this->parameters[i]), &(this->st_parameters), sizeof(dynamic_reconfigure::ParamDescription)); 00105 } 00106 union { 00107 int32_t real; 00108 uint32_t base; 00109 } u_parent; 00110 u_parent.base = 0; 00111 u_parent.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00112 u_parent.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00113 u_parent.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00114 u_parent.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00115 this->parent = u_parent.real; 00116 offset += sizeof(this->parent); 00117 union { 00118 int32_t real; 00119 uint32_t base; 00120 } u_id; 00121 u_id.base = 0; 00122 u_id.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00123 u_id.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00124 u_id.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00125 u_id.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00126 this->id = u_id.real; 00127 offset += sizeof(this->id); 00128 return offset; 00129 } 00130 00131 const char * getType(){ return "dynamic_reconfigure/Group"; }; 00132 const char * getMD5(){ return "9e8cd9e9423c94823db3614dd8b1cf7a"; }; 00133 00134 }; 00135 00136 } 00137 #endif
Generated on Tue Jul 12 2022 18:39:39 by 1.7.2