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