Go to the documentation of this file.00001 #ifndef _ROS_std_msgs_UInt32MultiArray_h
00002 #define _ROS_std_msgs_UInt32MultiArray_h
00003
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "std_msgs/MultiArrayLayout.h"
00009
00010 namespace std_msgs
00011 {
00012
00013 class UInt32MultiArray : public ros::Msg
00014 {
00015 public:
00016 std_msgs::MultiArrayLayout layout;
00017 uint8_t data_length;
00018 uint32_t st_data;
00019 uint32_t * data;
00020
00021 virtual int serialize(unsigned char *outbuffer) const
00022 {
00023 int offset = 0;
00024 offset += this->layout.serialize(outbuffer + offset);
00025 *(outbuffer + offset++) = data_length;
00026 *(outbuffer + offset++) = 0;
00027 *(outbuffer + offset++) = 0;
00028 *(outbuffer + offset++) = 0;
00029 for( uint8_t i = 0; i < data_length; i++){
00030 *(outbuffer + offset + 0) = (this->data[i] >> (8 * 0)) & 0xFF;
00031 *(outbuffer + offset + 1) = (this->data[i] >> (8 * 1)) & 0xFF;
00032 *(outbuffer + offset + 2) = (this->data[i] >> (8 * 2)) & 0xFF;
00033 *(outbuffer + offset + 3) = (this->data[i] >> (8 * 3)) & 0xFF;
00034 offset += sizeof(this->data[i]);
00035 }
00036 return offset;
00037 }
00038
00039 virtual int deserialize(unsigned char *inbuffer)
00040 {
00041 int offset = 0;
00042 offset += this->layout.deserialize(inbuffer + offset);
00043 uint8_t data_lengthT = *(inbuffer + offset++);
00044 if(data_lengthT > data_length)
00045 this->data = (uint32_t*)realloc(this->data, data_lengthT * sizeof(uint32_t));
00046 offset += 3;
00047 data_length = data_lengthT;
00048 for( uint8_t i = 0; i < data_length; i++){
00049 this->st_data = ((uint32_t) (*(inbuffer + offset)));
00050 this->st_data |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00051 this->st_data |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00052 this->st_data |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00053 offset += sizeof(this->st_data);
00054 memcpy( &(this->data[i]), &(this->st_data), sizeof(uint32_t));
00055 }
00056 return offset;
00057 }
00058
00059 const char * getType(){ return "std_msgs/UInt32MultiArray"; };
00060 const char * getMD5(){ return "4d6a180abc9be191b96a7eda6c8a233d"; };
00061
00062 };
00063
00064 }
00065 #endif