Go to the documentation of this file.00001 #ifndef _ROS_visualization_msgs_InteractiveMarkerUpdate_h
00002 #define _ROS_visualization_msgs_InteractiveMarkerUpdate_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 #include "visualization_msgs/InteractiveMarkerPose.h"
00010
00011 namespace visualization_msgs
00012 {
00013
00014 class InteractiveMarkerUpdate : public ros::Msg
00015 {
00016 public:
00017 const char* server_id;
00018 uint64_t seq_num;
00019 uint8_t type;
00020 uint8_t markers_length;
00021 visualization_msgs::InteractiveMarker st_markers;
00022 visualization_msgs::InteractiveMarker * markers;
00023 uint8_t poses_length;
00024 visualization_msgs::InteractiveMarkerPose st_poses;
00025 visualization_msgs::InteractiveMarkerPose * poses;
00026 uint8_t erases_length;
00027 char* st_erases;
00028 char* * erases;
00029 enum { KEEP_ALIVE = 0 };
00030 enum { UPDATE = 1 };
00031
00032 virtual int serialize(unsigned char *outbuffer) const
00033 {
00034 int offset = 0;
00035 uint32_t length_server_id = strlen(this->server_id);
00036 memcpy(outbuffer + offset, &length_server_id, sizeof(uint32_t));
00037 offset += 4;
00038 memcpy(outbuffer + offset, this->server_id, length_server_id);
00039 offset += length_server_id;
00040 union {
00041 uint64_t real;
00042 uint32_t base;
00043 } u_seq_num;
00044 u_seq_num.real = this->seq_num;
00045 *(outbuffer + offset + 0) = (u_seq_num.base >> (8 * 0)) & 0xFF;
00046 *(outbuffer + offset + 1) = (u_seq_num.base >> (8 * 1)) & 0xFF;
00047 *(outbuffer + offset + 2) = (u_seq_num.base >> (8 * 2)) & 0xFF;
00048 *(outbuffer + offset + 3) = (u_seq_num.base >> (8 * 3)) & 0xFF;
00049 offset += sizeof(this->seq_num);
00050 *(outbuffer + offset + 0) = (this->type >> (8 * 0)) & 0xFF;
00051 offset += sizeof(this->type);
00052 *(outbuffer + offset++) = markers_length;
00053 *(outbuffer + offset++) = 0;
00054 *(outbuffer + offset++) = 0;
00055 *(outbuffer + offset++) = 0;
00056 for( uint8_t i = 0; i < markers_length; i++){
00057 offset += this->markers[i].serialize(outbuffer + offset);
00058 }
00059 *(outbuffer + offset++) = poses_length;
00060 *(outbuffer + offset++) = 0;
00061 *(outbuffer + offset++) = 0;
00062 *(outbuffer + offset++) = 0;
00063 for( uint8_t i = 0; i < poses_length; i++){
00064 offset += this->poses[i].serialize(outbuffer + offset);
00065 }
00066 *(outbuffer + offset++) = erases_length;
00067 *(outbuffer + offset++) = 0;
00068 *(outbuffer + offset++) = 0;
00069 *(outbuffer + offset++) = 0;
00070 for( uint8_t i = 0; i < erases_length; i++){
00071 uint32_t length_erasesi = strlen(this->erases[i]);
00072 memcpy(outbuffer + offset, &length_erasesi, sizeof(uint32_t));
00073 offset += 4;
00074 memcpy(outbuffer + offset, this->erases[i], length_erasesi);
00075 offset += length_erasesi;
00076 }
00077 return offset;
00078 }
00079
00080 virtual int deserialize(unsigned char *inbuffer)
00081 {
00082 int offset = 0;
00083 uint32_t length_server_id;
00084 memcpy(&length_server_id, (inbuffer + offset), sizeof(uint32_t));
00085 offset += 4;
00086 for(unsigned int k= offset; k< offset+length_server_id; ++k){
00087 inbuffer[k-1]=inbuffer[k];
00088 }
00089 inbuffer[offset+length_server_id-1]=0;
00090 this->server_id = (char *)(inbuffer + offset-1);
00091 offset += length_server_id;
00092 union {
00093 uint64_t real;
00094 uint32_t base;
00095 } u_seq_num;
00096 u_seq_num.base = 0;
00097 u_seq_num.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00098 u_seq_num.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00099 u_seq_num.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00100 u_seq_num.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00101 this->seq_num = u_seq_num.real;
00102 offset += sizeof(this->seq_num);
00103 this->type = ((uint8_t) (*(inbuffer + offset)));
00104 offset += sizeof(this->type);
00105 uint8_t markers_lengthT = *(inbuffer + offset++);
00106 if(markers_lengthT > markers_length)
00107 this->markers = (visualization_msgs::InteractiveMarker*)realloc(this->markers, markers_lengthT * sizeof(visualization_msgs::InteractiveMarker));
00108 offset += 3;
00109 markers_length = markers_lengthT;
00110 for( uint8_t i = 0; i < markers_length; i++){
00111 offset += this->st_markers.deserialize(inbuffer + offset);
00112 memcpy( &(this->markers[i]), &(this->st_markers), sizeof(visualization_msgs::InteractiveMarker));
00113 }
00114 uint8_t poses_lengthT = *(inbuffer + offset++);
00115 if(poses_lengthT > poses_length)
00116 this->poses = (visualization_msgs::InteractiveMarkerPose*)realloc(this->poses, poses_lengthT * sizeof(visualization_msgs::InteractiveMarkerPose));
00117 offset += 3;
00118 poses_length = poses_lengthT;
00119 for( uint8_t i = 0; i < poses_length; i++){
00120 offset += this->st_poses.deserialize(inbuffer + offset);
00121 memcpy( &(this->poses[i]), &(this->st_poses), sizeof(visualization_msgs::InteractiveMarkerPose));
00122 }
00123 uint8_t erases_lengthT = *(inbuffer + offset++);
00124 if(erases_lengthT > erases_length)
00125 this->erases = (char**)realloc(this->erases, erases_lengthT * sizeof(char*));
00126 offset += 3;
00127 erases_length = erases_lengthT;
00128 for( uint8_t i = 0; i < erases_length; i++){
00129 uint32_t length_st_erases;
00130 memcpy(&length_st_erases, (inbuffer + offset), sizeof(uint32_t));
00131 offset += 4;
00132 for(unsigned int k= offset; k< offset+length_st_erases; ++k){
00133 inbuffer[k-1]=inbuffer[k];
00134 }
00135 inbuffer[offset+length_st_erases-1]=0;
00136 this->st_erases = (char *)(inbuffer + offset-1);
00137 offset += length_st_erases;
00138 memcpy( &(this->erases[i]), &(this->st_erases), sizeof(char*));
00139 }
00140 return offset;
00141 }
00142
00143 const char * getType(){ return "visualization_msgs/InteractiveMarkerUpdate"; };
00144 const char * getMD5(){ return "83e22f99d3b31fde725e0a338200e036"; };
00145
00146 };
00147
00148 }
00149 #endif