Go to the documentation of this file.00001 #ifndef _ROS_trajectory_msgs_JointTrajectory_h
00002 #define _ROS_trajectory_msgs_JointTrajectory_h
00003
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "std_msgs/Header.h"
00009 #include "trajectory_msgs/JointTrajectoryPoint.h"
00010
00011 namespace trajectory_msgs
00012 {
00013
00014 class JointTrajectory : public ros::Msg
00015 {
00016 public:
00017 std_msgs::Header header;
00018 uint8_t joint_names_length;
00019 char* st_joint_names;
00020 char* * joint_names;
00021 uint8_t points_length;
00022 trajectory_msgs::JointTrajectoryPoint st_points;
00023 trajectory_msgs::JointTrajectoryPoint * points;
00024
00025 virtual int serialize(unsigned char *outbuffer) const
00026 {
00027 int offset = 0;
00028 offset += this->header.serialize(outbuffer + offset);
00029 *(outbuffer + offset++) = joint_names_length;
00030 *(outbuffer + offset++) = 0;
00031 *(outbuffer + offset++) = 0;
00032 *(outbuffer + offset++) = 0;
00033 for( uint8_t i = 0; i < joint_names_length; i++){
00034 uint32_t length_joint_namesi = strlen(this->joint_names[i]);
00035 memcpy(outbuffer + offset, &length_joint_namesi, sizeof(uint32_t));
00036 offset += 4;
00037 memcpy(outbuffer + offset, this->joint_names[i], length_joint_namesi);
00038 offset += length_joint_namesi;
00039 }
00040 *(outbuffer + offset++) = points_length;
00041 *(outbuffer + offset++) = 0;
00042 *(outbuffer + offset++) = 0;
00043 *(outbuffer + offset++) = 0;
00044 for( uint8_t i = 0; i < points_length; i++){
00045 offset += this->points[i].serialize(outbuffer + offset);
00046 }
00047 return offset;
00048 }
00049
00050 virtual int deserialize(unsigned char *inbuffer)
00051 {
00052 int offset = 0;
00053 offset += this->header.deserialize(inbuffer + offset);
00054 uint8_t joint_names_lengthT = *(inbuffer + offset++);
00055 if(joint_names_lengthT > joint_names_length)
00056 this->joint_names = (char**)realloc(this->joint_names, joint_names_lengthT * sizeof(char*));
00057 offset += 3;
00058 joint_names_length = joint_names_lengthT;
00059 for( uint8_t i = 0; i < joint_names_length; i++){
00060 uint32_t length_st_joint_names;
00061 memcpy(&length_st_joint_names, (inbuffer + offset), sizeof(uint32_t));
00062 offset += 4;
00063 for(unsigned int k= offset; k< offset+length_st_joint_names; ++k){
00064 inbuffer[k-1]=inbuffer[k];
00065 }
00066 inbuffer[offset+length_st_joint_names-1]=0;
00067 this->st_joint_names = (char *)(inbuffer + offset-1);
00068 offset += length_st_joint_names;
00069 memcpy( &(this->joint_names[i]), &(this->st_joint_names), sizeof(char*));
00070 }
00071 uint8_t points_lengthT = *(inbuffer + offset++);
00072 if(points_lengthT > points_length)
00073 this->points = (trajectory_msgs::JointTrajectoryPoint*)realloc(this->points, points_lengthT * sizeof(trajectory_msgs::JointTrajectoryPoint));
00074 offset += 3;
00075 points_length = points_lengthT;
00076 for( uint8_t i = 0; i < points_length; i++){
00077 offset += this->st_points.deserialize(inbuffer + offset);
00078 memcpy( &(this->points[i]), &(this->st_points), sizeof(trajectory_msgs::JointTrajectoryPoint));
00079 }
00080 return offset;
00081 }
00082
00083 const char * getType(){ return "trajectory_msgs/JointTrajectory"; };
00084 const char * getMD5(){ return "65b4f94a94d1ed67169da35a02f33d3f"; };
00085
00086 };
00087
00088 }
00089 #endif