Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: rosserial_mbed_hello_world_publisher rtos_base_control rosserial_mbed_F64MA ROS-RTOS ... more
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 std_msgs::Header header; 00017 const char* data; 00018 00019 HeaderString(): 00020 header(), 00021 data("") 00022 { 00023 } 00024 00025 virtual int serialize(unsigned char *outbuffer) const 00026 { 00027 int offset = 0; 00028 offset += this->header.serialize(outbuffer + offset); 00029 uint32_t length_data = strlen(this->data); 00030 memcpy(outbuffer + offset, &length_data, sizeof(uint32_t)); 00031 offset += 4; 00032 memcpy(outbuffer + offset, this->data, length_data); 00033 offset += length_data; 00034 return offset; 00035 } 00036 00037 virtual int deserialize(unsigned char *inbuffer) 00038 { 00039 int offset = 0; 00040 offset += this->header.deserialize(inbuffer + offset); 00041 uint32_t length_data; 00042 memcpy(&length_data, (inbuffer + offset), sizeof(uint32_t)); 00043 offset += 4; 00044 for(unsigned int k= offset; k< offset+length_data; ++k){ 00045 inbuffer[k-1]=inbuffer[k]; 00046 } 00047 inbuffer[offset+length_data-1]=0; 00048 this->data = (char *)(inbuffer + offset-1); 00049 offset += length_data; 00050 return offset; 00051 } 00052 00053 const char * getType(){ return "rospy_tutorials/HeaderString"; }; 00054 const char * getMD5(){ return "c99a9440709e4d4a9716d55b8270d5e7"; }; 00055 00056 }; 00057 00058 } 00059 #endif
Generated on Tue Jul 12 2022 18:39:39 by
1.7.2