UInt16MultiArray.h
Go to the documentation of this file.
00001 #ifndef ros_std_msgs_UInt16MultiArray_h
00002 #define ros_std_msgs_UInt16MultiArray_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 UInt16MultiArray : public ros::Msg
00014   {
00015     public:
00016       std_msgs::MultiArrayLayout layout;
00017       unsigned char data_length;
00018       unsigned int st_data;
00019       unsigned int * data;
00020 
00021     virtual int serialize(unsigned char *outbuffer)
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( unsigned char i = 0; i < data_length; i++){
00030       union {
00031         unsigned int real;
00032         unsigned int base;
00033       } u_datai;
00034       u_datai.real = this->data[i];
00035       *(outbuffer + offset + 0) = (u_datai.base >> (8 * 0)) & 0xFF;
00036       *(outbuffer + offset + 1) = (u_datai.base >> (8 * 1)) & 0xFF;
00037       offset += sizeof(this->data[i]);
00038       }
00039       return offset;
00040     }
00041 
00042     virtual int deserialize(unsigned char *inbuffer)
00043     {
00044       int offset = 0;
00045       offset += this->layout.deserialize(inbuffer + offset);
00046       unsigned char data_lengthT = *(inbuffer + offset++);
00047       if(data_lengthT > data_length)
00048         this->data = (unsigned int*)realloc(this->data, data_lengthT * sizeof(unsigned int));
00049       offset += 3;
00050       data_length = data_lengthT;
00051       for( unsigned char i = 0; i < data_length; i++){
00052       union {
00053         unsigned int real;
00054         unsigned int base;
00055       } u_st_data;
00056       u_st_data.base = 0;
00057       u_st_data.base |= ((typeof(u_st_data.base)) (*(inbuffer + offset + 0))) << (8 * 0);
00058       u_st_data.base |= ((typeof(u_st_data.base)) (*(inbuffer + offset + 1))) << (8 * 1);
00059       this->st_data = u_st_data.real;
00060       offset += sizeof(this->st_data);
00061         memcpy( &(this->data[i]), &(this->st_data), sizeof(unsigned int));
00062       }
00063      return offset;
00064     }
00065 
00066     const char * getType(){ return "std_msgs/UInt16MultiArray"; };
00067 
00068   };
00069 
00070 }
00071 #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