InteractiveMarker.h
Go to the documentation of this file.
00001 #ifndef _ROS_visualization_msgs_InteractiveMarker_h
00002 #define _ROS_visualization_msgs_InteractiveMarker_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "std_msgs/Header.h"
00009 #include "geometry_msgs/Pose.h"
00010 #include "visualization_msgs/MenuEntry.h"
00011 #include "visualization_msgs/InteractiveMarkerControl.h"
00012 
00013 namespace visualization_msgs
00014 {
00015 
00016   class InteractiveMarker : public ros::Msg
00017   {
00018     public:
00019       std_msgs::Header header;
00020       geometry_msgs::Pose pose;
00021       char * name;
00022       char * description;
00023       float scale;
00024       uint8_t menu_entries_length;
00025       visualization_msgs::MenuEntry st_menu_entries;
00026       visualization_msgs::MenuEntry * menu_entries;
00027       uint8_t controls_length;
00028       visualization_msgs::InteractiveMarkerControl st_controls;
00029       visualization_msgs::InteractiveMarkerControl * controls;
00030 
00031     virtual int serialize(unsigned char *outbuffer) const
00032     {
00033       int offset = 0;
00034       offset += this->header.serialize(outbuffer + offset);
00035       offset += this->pose.serialize(outbuffer + offset);
00036       uint32_t length_name = strlen( (const char*) this->name);
00037       memcpy(outbuffer + offset, &length_name, sizeof(uint32_t));
00038       offset += 4;
00039       memcpy(outbuffer + offset, this->name, length_name);
00040       offset += length_name;
00041       uint32_t length_description = strlen( (const char*) this->description);
00042       memcpy(outbuffer + offset, &length_description, sizeof(uint32_t));
00043       offset += 4;
00044       memcpy(outbuffer + offset, this->description, length_description);
00045       offset += length_description;
00046       union {
00047         float real;
00048         uint32_t base;
00049       } u_scale;
00050       u_scale.real = this->scale;
00051       *(outbuffer + offset + 0) = (u_scale.base >> (8 * 0)) & 0xFF;
00052       *(outbuffer + offset + 1) = (u_scale.base >> (8 * 1)) & 0xFF;
00053       *(outbuffer + offset + 2) = (u_scale.base >> (8 * 2)) & 0xFF;
00054       *(outbuffer + offset + 3) = (u_scale.base >> (8 * 3)) & 0xFF;
00055       offset += sizeof(this->scale);
00056       *(outbuffer + offset++) = menu_entries_length;
00057       *(outbuffer + offset++) = 0;
00058       *(outbuffer + offset++) = 0;
00059       *(outbuffer + offset++) = 0;
00060       for( uint8_t i = 0; i < menu_entries_length; i++){
00061       offset += this->menu_entries[i].serialize(outbuffer + offset);
00062       }
00063       *(outbuffer + offset++) = controls_length;
00064       *(outbuffer + offset++) = 0;
00065       *(outbuffer + offset++) = 0;
00066       *(outbuffer + offset++) = 0;
00067       for( uint8_t i = 0; i < controls_length; i++){
00068       offset += this->controls[i].serialize(outbuffer + offset);
00069       }
00070       return offset;
00071     }
00072 
00073     virtual int deserialize(unsigned char *inbuffer)
00074     {
00075       int offset = 0;
00076       offset += this->header.deserialize(inbuffer + offset);
00077       offset += this->pose.deserialize(inbuffer + offset);
00078       uint32_t length_name;
00079       memcpy(&length_name, (inbuffer + offset), sizeof(uint32_t));
00080       offset += 4;
00081       for(unsigned int k= offset; k< offset+length_name; ++k){
00082           inbuffer[k-1]=inbuffer[k];
00083       }
00084       inbuffer[offset+length_name-1]=0;
00085       this->name = (char *)(inbuffer + offset-1);
00086       offset += length_name;
00087       uint32_t length_description;
00088       memcpy(&length_description, (inbuffer + offset), sizeof(uint32_t));
00089       offset += 4;
00090       for(unsigned int k= offset; k< offset+length_description; ++k){
00091           inbuffer[k-1]=inbuffer[k];
00092       }
00093       inbuffer[offset+length_description-1]=0;
00094       this->description = (char *)(inbuffer + offset-1);
00095       offset += length_description;
00096       union {
00097         float real;
00098         uint32_t base;
00099       } u_scale;
00100       u_scale.base = 0;
00101       u_scale.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00102       u_scale.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00103       u_scale.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00104       u_scale.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00105       this->scale = u_scale.real;
00106       offset += sizeof(this->scale);
00107       uint8_t menu_entries_lengthT = *(inbuffer + offset++);
00108       if(menu_entries_lengthT > menu_entries_length)
00109         this->menu_entries = (visualization_msgs::MenuEntry*)realloc(this->menu_entries, menu_entries_lengthT * sizeof(visualization_msgs::MenuEntry));
00110       offset += 3;
00111       menu_entries_length = menu_entries_lengthT;
00112       for( uint8_t i = 0; i < menu_entries_length; i++){
00113       offset += this->st_menu_entries.deserialize(inbuffer + offset);
00114         memcpy( &(this->menu_entries[i]), &(this->st_menu_entries), sizeof(visualization_msgs::MenuEntry));
00115       }
00116       uint8_t controls_lengthT = *(inbuffer + offset++);
00117       if(controls_lengthT > controls_length)
00118         this->controls = (visualization_msgs::InteractiveMarkerControl*)realloc(this->controls, controls_lengthT * sizeof(visualization_msgs::InteractiveMarkerControl));
00119       offset += 3;
00120       controls_length = controls_lengthT;
00121       for( uint8_t i = 0; i < controls_length; i++){
00122       offset += this->st_controls.deserialize(inbuffer + offset);
00123         memcpy( &(this->controls[i]), &(this->st_controls), sizeof(visualization_msgs::InteractiveMarkerControl));
00124       }
00125      return offset;
00126     }
00127 
00128     const char * getType(){ return "visualization_msgs/InteractiveMarker"; };
00129     const char * getMD5(){ return "311bd5f6cd6a20820ac0ba84315f4e22"; };
00130 
00131   };
00132 
00133 }
00134 #endif


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