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


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