Int64MultiArray.h
Go to the documentation of this file.
00001 #ifndef ros_std_msgs_Int64MultiArray_h
00002 #define ros_std_msgs_Int64MultiArray_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 Int64MultiArray : public ros::Msg
00014   {
00015     public:
00016       std_msgs::MultiArrayLayout layout;
00017       unsigned char data_length;
00018       long st_data;
00019       long * 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       *(outbuffer + offset++) = (data[i] >> (8 * 0)) & 0xFF;
00031       *(outbuffer + offset++) = (data[i] >> (8 * 1)) & 0xFF;
00032       *(outbuffer + offset++) = (data[i] >> (8 * 2)) & 0xFF;
00033       *(outbuffer + offset++) = (data[i] >> (8 * 3)) & 0xFF;
00034       *(outbuffer + offset++) = (data[i] > 0) ? 0: 255;
00035       *(outbuffer + offset++) = (data[i] > 0) ? 0: 255;
00036       *(outbuffer + offset++) = (data[i] > 0) ? 0: 255;
00037       *(outbuffer + offset++) = (data[i] > 0) ? 0: 255;
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 = (long*)realloc(this->data, data_lengthT * sizeof(long));
00049       offset += 3;
00050       data_length = data_lengthT;
00051       for( unsigned char i = 0; i < data_length; i++){
00052       st_data = 0;
00053       st_data += ((long)(*(inbuffer + offset++))) >> (8 * 0);
00054       st_data += ((long)(*(inbuffer + offset++))) >> (8 * 1);
00055       st_data += ((long)(*(inbuffer + offset++))) >> (8 * 2);
00056       st_data += ((long)(*(inbuffer + offset++))) >> (8 * 3);
00057       offset += 4;
00058         memcpy( &(this->data[i]), &(this->st_data), sizeof(long));
00059       }
00060      return offset;
00061     }
00062 
00063     const char * getType(){ return "std_msgs/Int64MultiArray"; };
00064 
00065   };
00066 
00067 }
00068 #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