annop niponsiritham / ros_lib_kinetic

Dependencies:   BufferedSerial

Dependents:   mobile_robot mobile_robot_ver2

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GoalStatus.h Source File

GoalStatus.h

00001 #ifndef _ROS_actionlib_msgs_GoalStatus_h
00002 #define _ROS_actionlib_msgs_GoalStatus_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "actionlib_msgs/GoalID.h"
00009 
00010 namespace actionlib_msgs
00011 {
00012 
00013   class GoalStatus : public ros::Msg
00014   {
00015     public:
00016       typedef actionlib_msgs::GoalID _goal_id_type;
00017       _goal_id_type goal_id;
00018       typedef uint8_t _status_type;
00019       _status_type status;
00020       typedef const char* _text_type;
00021       _text_type text;
00022       enum { PENDING =  0    };
00023       enum { ACTIVE =  1    };
00024       enum { PREEMPTED =  2    };
00025       enum { SUCCEEDED =  3    };
00026       enum { ABORTED =  4    };
00027       enum { REJECTED =  5    };
00028       enum { PREEMPTING =  6    };
00029       enum { RECALLING =  7    };
00030       enum { RECALLED =  8    };
00031       enum { LOST =  9    };
00032 
00033     GoalStatus():
00034       goal_id(),
00035       status(0),
00036       text("")
00037     {
00038     }
00039 
00040     virtual int serialize(unsigned char *outbuffer) const
00041     {
00042       int offset = 0;
00043       offset += this->goal_id.serialize(outbuffer + offset);
00044       *(outbuffer + offset + 0) = (this->status >> (8 * 0)) & 0xFF;
00045       offset += sizeof(this->status);
00046       uint32_t length_text = strlen(this->text);
00047       varToArr(outbuffer + offset, length_text);
00048       offset += 4;
00049       memcpy(outbuffer + offset, this->text, length_text);
00050       offset += length_text;
00051       return offset;
00052     }
00053 
00054     virtual int deserialize(unsigned char *inbuffer)
00055     {
00056       int offset = 0;
00057       offset += this->goal_id.deserialize(inbuffer + offset);
00058       this->status =  ((uint8_t) (*(inbuffer + offset)));
00059       offset += sizeof(this->status);
00060       uint32_t length_text;
00061       arrToVar(length_text, (inbuffer + offset));
00062       offset += 4;
00063       for(unsigned int k= offset; k< offset+length_text; ++k){
00064           inbuffer[k-1]=inbuffer[k];
00065       }
00066       inbuffer[offset+length_text-1]=0;
00067       this->text = (char *)(inbuffer + offset-1);
00068       offset += length_text;
00069      return offset;
00070     }
00071 
00072     const char * getType(){ return "actionlib_msgs/GoalStatus"; };
00073     const char * getMD5(){ return "d388f9b87b3c471f784434d671988d4a"; };
00074 
00075   };
00076 
00077 }
00078 #endif