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.
Fork of rosserial_mbed_lib by
MultiArrayDimension.h
00001 #ifndef _ROS_std_msgs_MultiArrayDimension_h 00002 #define _ROS_std_msgs_MultiArrayDimension_h 00003 00004 #include <stdint.h> 00005 #include <string.h> 00006 #include <stdlib.h> 00007 #include "ros/msg.h" 00008 00009 namespace std_msgs 00010 { 00011 00012 class MultiArrayDimension : public ros::Msg 00013 { 00014 public: 00015 char * label; 00016 uint32_t size; 00017 uint32_t stride; 00018 00019 virtual int serialize(unsigned char *outbuffer) const 00020 { 00021 int offset = 0; 00022 uint32_t * length_label = (uint32_t *)(outbuffer + offset); 00023 *length_label = strlen( (const char*) this->label); 00024 offset += 4; 00025 memcpy(outbuffer + offset, this->label, *length_label); 00026 offset += *length_label; 00027 *(outbuffer + offset + 0) = (this->size >> (8 * 0)) & 0xFF; 00028 *(outbuffer + offset + 1) = (this->size >> (8 * 1)) & 0xFF; 00029 *(outbuffer + offset + 2) = (this->size >> (8 * 2)) & 0xFF; 00030 *(outbuffer + offset + 3) = (this->size >> (8 * 3)) & 0xFF; 00031 offset += sizeof(this->size); 00032 *(outbuffer + offset + 0) = (this->stride >> (8 * 0)) & 0xFF; 00033 *(outbuffer + offset + 1) = (this->stride >> (8 * 1)) & 0xFF; 00034 *(outbuffer + offset + 2) = (this->stride >> (8 * 2)) & 0xFF; 00035 *(outbuffer + offset + 3) = (this->stride >> (8 * 3)) & 0xFF; 00036 offset += sizeof(this->stride); 00037 return offset; 00038 } 00039 00040 virtual int deserialize(unsigned char *inbuffer) 00041 { 00042 int offset = 0; 00043 uint32_t length_label = *(uint32_t *)(inbuffer + offset); 00044 offset += 4; 00045 for(unsigned int k= offset; k< offset+length_label; ++k){ 00046 inbuffer[k-1]=inbuffer[k]; 00047 } 00048 inbuffer[offset+length_label-1]=0; 00049 this->label = (char *)(inbuffer + offset-1); 00050 offset += length_label; 00051 this->size |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00052 this->size |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00053 this->size |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00054 this->size |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00055 offset += sizeof(this->size); 00056 this->stride |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00057 this->stride |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00058 this->stride |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00059 this->stride |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00060 offset += sizeof(this->stride); 00061 return offset; 00062 } 00063 00064 virtual const char * getType(){ return "std_msgs/MultiArrayDimension"; }; 00065 virtual const char * getMD5(){ return "4cd0c83a8683deae40ecdac60e53bfa8"; }; 00066 00067 }; 00068 00069 } 00070 #endif
Generated on Tue Jul 12 2022 19:53:57 by
1.7.2
