catchrobo2022 / Mbed 2 deprecated catchrobo2022_mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers PlannerInterfaceDescription.h Source File

PlannerInterfaceDescription.h

00001 #ifndef _ROS_moveit_msgs_PlannerInterfaceDescription_h
00002 #define _ROS_moveit_msgs_PlannerInterfaceDescription_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace moveit_msgs
00010 {
00011 
00012   class PlannerInterfaceDescription : public ros::Msg
00013   {
00014     public:
00015       typedef const char* _name_type;
00016       _name_type name;
00017       uint32_t planner_ids_length;
00018       typedef char* _planner_ids_type;
00019       _planner_ids_type st_planner_ids;
00020       _planner_ids_type * planner_ids;
00021 
00022     PlannerInterfaceDescription():
00023       name(""),
00024       planner_ids_length(0), planner_ids(NULL)
00025     {
00026     }
00027 
00028     virtual int serialize(unsigned char *outbuffer) const
00029     {
00030       int offset = 0;
00031       uint32_t length_name = strlen(this->name);
00032       varToArr(outbuffer + offset, length_name);
00033       offset += 4;
00034       memcpy(outbuffer + offset, this->name, length_name);
00035       offset += length_name;
00036       *(outbuffer + offset + 0) = (this->planner_ids_length >> (8 * 0)) & 0xFF;
00037       *(outbuffer + offset + 1) = (this->planner_ids_length >> (8 * 1)) & 0xFF;
00038       *(outbuffer + offset + 2) = (this->planner_ids_length >> (8 * 2)) & 0xFF;
00039       *(outbuffer + offset + 3) = (this->planner_ids_length >> (8 * 3)) & 0xFF;
00040       offset += sizeof(this->planner_ids_length);
00041       for( uint32_t i = 0; i < planner_ids_length; i++){
00042       uint32_t length_planner_idsi = strlen(this->planner_ids[i]);
00043       varToArr(outbuffer + offset, length_planner_idsi);
00044       offset += 4;
00045       memcpy(outbuffer + offset, this->planner_ids[i], length_planner_idsi);
00046       offset += length_planner_idsi;
00047       }
00048       return offset;
00049     }
00050 
00051     virtual int deserialize(unsigned char *inbuffer)
00052     {
00053       int offset = 0;
00054       uint32_t length_name;
00055       arrToVar(length_name, (inbuffer + offset));
00056       offset += 4;
00057       for(unsigned int k= offset; k< offset+length_name; ++k){
00058           inbuffer[k-1]=inbuffer[k];
00059       }
00060       inbuffer[offset+length_name-1]=0;
00061       this->name = (char *)(inbuffer + offset-1);
00062       offset += length_name;
00063       uint32_t planner_ids_lengthT = ((uint32_t) (*(inbuffer + offset))); 
00064       planner_ids_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 
00065       planner_ids_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 
00066       planner_ids_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 
00067       offset += sizeof(this->planner_ids_length);
00068       if(planner_ids_lengthT > planner_ids_length)
00069         this->planner_ids = (char**)realloc(this->planner_ids, planner_ids_lengthT * sizeof(char*));
00070       planner_ids_length = planner_ids_lengthT;
00071       for( uint32_t i = 0; i < planner_ids_length; i++){
00072       uint32_t length_st_planner_ids;
00073       arrToVar(length_st_planner_ids, (inbuffer + offset));
00074       offset += 4;
00075       for(unsigned int k= offset; k< offset+length_st_planner_ids; ++k){
00076           inbuffer[k-1]=inbuffer[k];
00077       }
00078       inbuffer[offset+length_st_planner_ids-1]=0;
00079       this->st_planner_ids = (char *)(inbuffer + offset-1);
00080       offset += length_st_planner_ids;
00081         memcpy( &(this->planner_ids[i]), &(this->st_planner_ids), sizeof(char*));
00082       }
00083      return offset;
00084     }
00085 
00086     virtual const char * getType(){ return "moveit_msgs/PlannerInterfaceDescription"; };
00087     virtual const char * getMD5(){ return "ea5f6e6129aa1b110ccda9900d2bf25e"; };
00088 
00089   };
00090 
00091 }
00092 #endif