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       unsigned char dim_length;
00017       std_msgs::MultiArrayDimension st_dim;
00018       std_msgs::MultiArrayDimension * dim;
00019       unsigned long data_offset;
00020 
00021     virtual int serialize(unsigned char *outbuffer)
00022     {
00023       int offset = 0;
00024       *(outbuffer + offset++) = dim_length;
00025       *(outbuffer + offset++) = 0;
00026       *(outbuffer + offset++) = 0;
00027       *(outbuffer + offset++) = 0;
00028       for( unsigned char i = 0; i < dim_length; i++){
00029       offset += this->dim[i].serialize(outbuffer + offset);
00030       }
00031       union {
00032         unsigned long real;
00033         unsigned long base;
00034       } u_data_offset;
00035       u_data_offset.real = this->data_offset;
00036       *(outbuffer + offset + 0) = (u_data_offset.base >> (8 * 0)) & 0xFF;
00037       *(outbuffer + offset + 1) = (u_data_offset.base >> (8 * 1)) & 0xFF;
00038       *(outbuffer + offset + 2) = (u_data_offset.base >> (8 * 2)) & 0xFF;
00039       *(outbuffer + offset + 3) = (u_data_offset.base >> (8 * 3)) & 0xFF;
00040       offset += sizeof(this->data_offset);
00041       return offset;
00042     }
00043 
00044     virtual int deserialize(unsigned char *inbuffer)
00045     {
00046       int offset = 0;
00047       unsigned char dim_lengthT = *(inbuffer + offset++);
00048       if(dim_lengthT > dim_length)
00049         this->dim = (std_msgs::MultiArrayDimension*)realloc(this->dim, dim_lengthT * sizeof(std_msgs::MultiArrayDimension));
00050       offset += 3;
00051       dim_length = dim_lengthT;
00052       for( unsigned char i = 0; i < dim_length; i++){
00053       offset += this->st_dim.deserialize(inbuffer + offset);
00054         memcpy( &(this->dim[i]), &(this->st_dim), sizeof(std_msgs::MultiArrayDimension));
00055       }
00056       union {
00057         unsigned long real;
00058         unsigned long base;
00059       } u_data_offset;
00060       u_data_offset.base = 0;
00061       u_data_offset.base |= ((typeof(u_data_offset.base)) (*(inbuffer + offset + 0))) << (8 * 0);
00062       u_data_offset.base |= ((typeof(u_data_offset.base)) (*(inbuffer + offset + 1))) << (8 * 1);
00063       u_data_offset.base |= ((typeof(u_data_offset.base)) (*(inbuffer + offset + 2))) << (8 * 2);
00064       u_data_offset.base |= ((typeof(u_data_offset.base)) (*(inbuffer + offset + 3))) << (8 * 3);
00065       this->data_offset = u_data_offset.real;
00066       offset += sizeof(this->data_offset);
00067      return offset;
00068     }
00069 
00070     const char * getType(){ return "std_msgs/MultiArrayLayout"; };
00071 
00072   };
00073 
00074 }
00075 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


traxbot_robot
Author(s): André Gonçalves Araújo
autogenerated on Fri Feb 1 2013 13:21:12