Working towards recieving twists
Fork of ros_lib_kinetic by
Embed:
(wiki syntax)
Show/hide line numbers
HeaderString.h
00001 #ifndef _ROS_rospy_tutorials_HeaderString_h 00002 #define _ROS_rospy_tutorials_HeaderString_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 00010 namespace rospy_tutorials 00011 { 00012 00013 class HeaderString : public ros::Msg 00014 { 00015 public: 00016 typedef std_msgs::Header _header_type; 00017 _header_type header; 00018 typedef const char* _data_type; 00019 _data_type data; 00020 00021 HeaderString(): 00022 header(), 00023 data("") 00024 { 00025 } 00026 00027 virtual int serialize(unsigned char *outbuffer) const 00028 { 00029 int offset = 0; 00030 offset += this->header.serialize(outbuffer + offset); 00031 uint32_t length_data = strlen(this->data); 00032 varToArr(outbuffer + offset, length_data); 00033 offset += 4; 00034 memcpy(outbuffer + offset, this->data, length_data); 00035 offset += length_data; 00036 return offset; 00037 } 00038 00039 virtual int deserialize(unsigned char *inbuffer) 00040 { 00041 int offset = 0; 00042 offset += this->header.deserialize(inbuffer + offset); 00043 uint32_t length_data; 00044 arrToVar(length_data, (inbuffer + offset)); 00045 offset += 4; 00046 for(unsigned int k= offset; k< offset+length_data; ++k){ 00047 inbuffer[k-1]=inbuffer[k]; 00048 } 00049 inbuffer[offset+length_data-1]=0; 00050 this->data = (char *)(inbuffer + offset-1); 00051 offset += length_data; 00052 return offset; 00053 } 00054 00055 const char * getType(){ return "rospy_tutorials/HeaderString"; }; 00056 const char * getMD5(){ return "c99a9440709e4d4a9716d55b8270d5e7"; }; 00057 00058 }; 00059 00060 } 00061 #endif
Generated on Tue Jul 12 2022 21:32:16 by 1.7.2