Working towards recieving twists

Dependencies:   BufferedSerial

Fork of ros_lib_kinetic by Gary Servin

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GoalID.h Source File

GoalID.h

00001 #ifndef _ROS_actionlib_msgs_GoalID_h
00002 #define _ROS_actionlib_msgs_GoalID_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "ros/time.h"
00009 
00010 namespace actionlib_msgs
00011 {
00012 
00013   class GoalID : public ros::Msg
00014   {
00015     public:
00016       typedef ros::Time _stamp_type;
00017       _stamp_type stamp;
00018       typedef const char* _id_type;
00019       _id_type id;
00020 
00021     GoalID():
00022       stamp(),
00023       id("")
00024     {
00025     }
00026 
00027     virtual int serialize(unsigned char *outbuffer) const
00028     {
00029       int offset = 0;
00030       *(outbuffer + offset + 0) = (this->stamp.sec >> (8 * 0)) & 0xFF;
00031       *(outbuffer + offset + 1) = (this->stamp.sec >> (8 * 1)) & 0xFF;
00032       *(outbuffer + offset + 2) = (this->stamp.sec >> (8 * 2)) & 0xFF;
00033       *(outbuffer + offset + 3) = (this->stamp.sec >> (8 * 3)) & 0xFF;
00034       offset += sizeof(this->stamp.sec);
00035       *(outbuffer + offset + 0) = (this->stamp.nsec >> (8 * 0)) & 0xFF;
00036       *(outbuffer + offset + 1) = (this->stamp.nsec >> (8 * 1)) & 0xFF;
00037       *(outbuffer + offset + 2) = (this->stamp.nsec >> (8 * 2)) & 0xFF;
00038       *(outbuffer + offset + 3) = (this->stamp.nsec >> (8 * 3)) & 0xFF;
00039       offset += sizeof(this->stamp.nsec);
00040       uint32_t length_id = strlen(this->id);
00041       varToArr(outbuffer + offset, length_id);
00042       offset += 4;
00043       memcpy(outbuffer + offset, this->id, length_id);
00044       offset += length_id;
00045       return offset;
00046     }
00047 
00048     virtual int deserialize(unsigned char *inbuffer)
00049     {
00050       int offset = 0;
00051       this->stamp.sec =  ((uint32_t) (*(inbuffer + offset)));
00052       this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00053       this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00054       this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00055       offset += sizeof(this->stamp.sec);
00056       this->stamp.nsec =  ((uint32_t) (*(inbuffer + offset)));
00057       this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00058       this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00059       this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00060       offset += sizeof(this->stamp.nsec);
00061       uint32_t length_id;
00062       arrToVar(length_id, (inbuffer + offset));
00063       offset += 4;
00064       for(unsigned int k= offset; k< offset+length_id; ++k){
00065           inbuffer[k-1]=inbuffer[k];
00066       }
00067       inbuffer[offset+length_id-1]=0;
00068       this->id = (char *)(inbuffer + offset-1);
00069       offset += length_id;
00070      return offset;
00071     }
00072 
00073     const char * getType(){ return "actionlib_msgs/GoalID"; };
00074     const char * getMD5(){ return "302881f31927c1df708a2dbab0e80ee8"; };
00075 
00076   };
00077 
00078 }
00079 #endif