Go to the documentation of this file.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 const 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 = strlen(this->label);
00023 memcpy(outbuffer + offset, &length_label, sizeof(uint32_t));
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;
00044 memcpy(&length_label, (inbuffer + offset), sizeof(uint32_t));
00045 offset += 4;
00046 for(unsigned int k= offset; k< offset+length_label; ++k){
00047 inbuffer[k-1]=inbuffer[k];
00048 }
00049 inbuffer[offset+length_label-1]=0;
00050 this->label = (char *)(inbuffer + offset-1);
00051 offset += length_label;
00052 this->size = ((uint32_t) (*(inbuffer + offset)));
00053 this->size |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00054 this->size |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00055 this->size |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00056 offset += sizeof(this->size);
00057 this->stride = ((uint32_t) (*(inbuffer + offset)));
00058 this->stride |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00059 this->stride |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00060 this->stride |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00061 offset += sizeof(this->stride);
00062 return offset;
00063 }
00064
00065 const char * getType(){ return "std_msgs/MultiArrayDimension"; };
00066 const char * getMD5(){ return "4cd0c83a8683deae40ecdac60e53bfa8"; };
00067
00068 };
00069
00070 }
00071 #endif