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       uint8_t data_length;
00018       uint16_t st_data;
00019       uint16_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       offset += sizeof(this->data[i]);
00033       }
00034       return offset;
00035     }
00036 
00037     virtual int deserialize(unsigned char *inbuffer)
00038     {
00039       int offset = 0;
00040       offset += this->layout.deserialize(inbuffer + offset);
00041       uint8_t data_lengthT = *(inbuffer + offset++);
00042       if(data_lengthT > data_length)
00043         this->data = (uint16_t*)realloc(this->data, data_lengthT * sizeof(uint16_t));
00044       offset += 3;
00045       data_length = data_lengthT;
00046       for( uint8_t i = 0; i < data_length; i++){
00047       this->st_data =  ((uint16_t) (*(inbuffer + offset)));
00048       this->st_data |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
00049       offset += sizeof(this->st_data);
00050         memcpy( &(this->data[i]), &(this->st_data), sizeof(uint16_t));
00051       }
00052      return offset;
00053     }
00054 
00055     const char * getType(){ return "std_msgs/UInt16MultiArray"; };
00056     const char * getMD5(){ return "52f264f1c973c4b73790d384c6cb4484"; };
00057 
00058   };
00059 
00060 }
00061 #endif


lizi_arduino
Author(s): RoboTiCan
autogenerated on Wed Aug 26 2015 12:24:23