MenuEntry.h
Go to the documentation of this file.
00001 #ifndef _ROS_visualization_msgs_MenuEntry_h
00002 #define _ROS_visualization_msgs_MenuEntry_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace visualization_msgs
00010 {
00011 
00012   class MenuEntry : public ros::Msg
00013   {
00014     public:
00015       uint32_t id;
00016       uint32_t parent_id;
00017       char * title;
00018       char * command;
00019       uint8_t command_type;
00020       enum { FEEDBACK = 0 };
00021       enum { ROSRUN = 1 };
00022       enum { ROSLAUNCH = 2 };
00023 
00024     virtual int serialize(unsigned char *outbuffer) const
00025     {
00026       int offset = 0;
00027       *(outbuffer + offset + 0) = (this->id >> (8 * 0)) & 0xFF;
00028       *(outbuffer + offset + 1) = (this->id >> (8 * 1)) & 0xFF;
00029       *(outbuffer + offset + 2) = (this->id >> (8 * 2)) & 0xFF;
00030       *(outbuffer + offset + 3) = (this->id >> (8 * 3)) & 0xFF;
00031       offset += sizeof(this->id);
00032       *(outbuffer + offset + 0) = (this->parent_id >> (8 * 0)) & 0xFF;
00033       *(outbuffer + offset + 1) = (this->parent_id >> (8 * 1)) & 0xFF;
00034       *(outbuffer + offset + 2) = (this->parent_id >> (8 * 2)) & 0xFF;
00035       *(outbuffer + offset + 3) = (this->parent_id >> (8 * 3)) & 0xFF;
00036       offset += sizeof(this->parent_id);
00037       uint32_t length_title = strlen( (const char*) this->title);
00038       memcpy(outbuffer + offset, &length_title, sizeof(uint32_t));
00039       offset += 4;
00040       memcpy(outbuffer + offset, this->title, length_title);
00041       offset += length_title;
00042       uint32_t length_command = strlen( (const char*) this->command);
00043       memcpy(outbuffer + offset, &length_command, sizeof(uint32_t));
00044       offset += 4;
00045       memcpy(outbuffer + offset, this->command, length_command);
00046       offset += length_command;
00047       *(outbuffer + offset + 0) = (this->command_type >> (8 * 0)) & 0xFF;
00048       offset += sizeof(this->command_type);
00049       return offset;
00050     }
00051 
00052     virtual int deserialize(unsigned char *inbuffer)
00053     {
00054       int offset = 0;
00055       this->id =  ((uint32_t) (*(inbuffer + offset)));
00056       this->id |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00057       this->id |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00058       this->id |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00059       offset += sizeof(this->id);
00060       this->parent_id =  ((uint32_t) (*(inbuffer + offset)));
00061       this->parent_id |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00062       this->parent_id |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00063       this->parent_id |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00064       offset += sizeof(this->parent_id);
00065       uint32_t length_title;
00066       memcpy(&length_title, (inbuffer + offset), sizeof(uint32_t));
00067       offset += 4;
00068       for(unsigned int k= offset; k< offset+length_title; ++k){
00069           inbuffer[k-1]=inbuffer[k];
00070       }
00071       inbuffer[offset+length_title-1]=0;
00072       this->title = (char *)(inbuffer + offset-1);
00073       offset += length_title;
00074       uint32_t length_command;
00075       memcpy(&length_command, (inbuffer + offset), sizeof(uint32_t));
00076       offset += 4;
00077       for(unsigned int k= offset; k< offset+length_command; ++k){
00078           inbuffer[k-1]=inbuffer[k];
00079       }
00080       inbuffer[offset+length_command-1]=0;
00081       this->command = (char *)(inbuffer + offset-1);
00082       offset += length_command;
00083       this->command_type =  ((uint8_t) (*(inbuffer + offset)));
00084       offset += sizeof(this->command_type);
00085      return offset;
00086     }
00087 
00088     const char * getType(){ return "visualization_msgs/MenuEntry"; };
00089     const char * getMD5(){ return "b90ec63024573de83b57aa93eb39be2d"; };
00090 
00091   };
00092 
00093 }
00094 #endif


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