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


ric_mc
Author(s): RoboTiCan
autogenerated on Thu Aug 27 2015 14:39:49