Go to the documentation of this file.00001 #ifndef _ROS_SERVICE_GetModelDescription_h
00002 #define _ROS_SERVICE_GetModelDescription_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 #include "household_objects_database_msgs/DatabaseReturnCode.h"
00008
00009 namespace household_objects_database_msgs
00010 {
00011
00012 static const char GETMODELDESCRIPTION[] = "household_objects_database_msgs/GetModelDescription";
00013
00014 class GetModelDescriptionRequest : public ros::Msg
00015 {
00016 public:
00017 int32_t model_id;
00018
00019 virtual int serialize(unsigned char *outbuffer) const
00020 {
00021 int offset = 0;
00022 union {
00023 int32_t real;
00024 uint32_t base;
00025 } u_model_id;
00026 u_model_id.real = this->model_id;
00027 *(outbuffer + offset + 0) = (u_model_id.base >> (8 * 0)) & 0xFF;
00028 *(outbuffer + offset + 1) = (u_model_id.base >> (8 * 1)) & 0xFF;
00029 *(outbuffer + offset + 2) = (u_model_id.base >> (8 * 2)) & 0xFF;
00030 *(outbuffer + offset + 3) = (u_model_id.base >> (8 * 3)) & 0xFF;
00031 offset += sizeof(this->model_id);
00032 return offset;
00033 }
00034
00035 virtual int deserialize(unsigned char *inbuffer)
00036 {
00037 int offset = 0;
00038 union {
00039 int32_t real;
00040 uint32_t base;
00041 } u_model_id;
00042 u_model_id.base = 0;
00043 u_model_id.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00044 u_model_id.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00045 u_model_id.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00046 u_model_id.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00047 this->model_id = u_model_id.real;
00048 offset += sizeof(this->model_id);
00049 return offset;
00050 }
00051
00052 const char * getType(){ return GETMODELDESCRIPTION; };
00053 const char * getMD5(){ return "28cb0598daf3b969068a38cd07aaa9f6"; };
00054
00055 };
00056
00057 class GetModelDescriptionResponse : public ros::Msg
00058 {
00059 public:
00060 household_objects_database_msgs::DatabaseReturnCode return_code;
00061 uint8_t tags_length;
00062 char* st_tags;
00063 char* * tags;
00064 const char* name;
00065 const char* maker;
00066
00067 virtual int serialize(unsigned char *outbuffer) const
00068 {
00069 int offset = 0;
00070 offset += this->return_code.serialize(outbuffer + offset);
00071 *(outbuffer + offset++) = tags_length;
00072 *(outbuffer + offset++) = 0;
00073 *(outbuffer + offset++) = 0;
00074 *(outbuffer + offset++) = 0;
00075 for( uint8_t i = 0; i < tags_length; i++){
00076 uint32_t length_tagsi = strlen(this->tags[i]);
00077 memcpy(outbuffer + offset, &length_tagsi, sizeof(uint32_t));
00078 offset += 4;
00079 memcpy(outbuffer + offset, this->tags[i], length_tagsi);
00080 offset += length_tagsi;
00081 }
00082 uint32_t length_name = strlen(this->name);
00083 memcpy(outbuffer + offset, &length_name, sizeof(uint32_t));
00084 offset += 4;
00085 memcpy(outbuffer + offset, this->name, length_name);
00086 offset += length_name;
00087 uint32_t length_maker = strlen(this->maker);
00088 memcpy(outbuffer + offset, &length_maker, sizeof(uint32_t));
00089 offset += 4;
00090 memcpy(outbuffer + offset, this->maker, length_maker);
00091 offset += length_maker;
00092 return offset;
00093 }
00094
00095 virtual int deserialize(unsigned char *inbuffer)
00096 {
00097 int offset = 0;
00098 offset += this->return_code.deserialize(inbuffer + offset);
00099 uint8_t tags_lengthT = *(inbuffer + offset++);
00100 if(tags_lengthT > tags_length)
00101 this->tags = (char**)realloc(this->tags, tags_lengthT * sizeof(char*));
00102 offset += 3;
00103 tags_length = tags_lengthT;
00104 for( uint8_t i = 0; i < tags_length; i++){
00105 uint32_t length_st_tags;
00106 memcpy(&length_st_tags, (inbuffer + offset), sizeof(uint32_t));
00107 offset += 4;
00108 for(unsigned int k= offset; k< offset+length_st_tags; ++k){
00109 inbuffer[k-1]=inbuffer[k];
00110 }
00111 inbuffer[offset+length_st_tags-1]=0;
00112 this->st_tags = (char *)(inbuffer + offset-1);
00113 offset += length_st_tags;
00114 memcpy( &(this->tags[i]), &(this->st_tags), sizeof(char*));
00115 }
00116 uint32_t length_name;
00117 memcpy(&length_name, (inbuffer + offset), sizeof(uint32_t));
00118 offset += 4;
00119 for(unsigned int k= offset; k< offset+length_name; ++k){
00120 inbuffer[k-1]=inbuffer[k];
00121 }
00122 inbuffer[offset+length_name-1]=0;
00123 this->name = (char *)(inbuffer + offset-1);
00124 offset += length_name;
00125 uint32_t length_maker;
00126 memcpy(&length_maker, (inbuffer + offset), sizeof(uint32_t));
00127 offset += 4;
00128 for(unsigned int k= offset; k< offset+length_maker; ++k){
00129 inbuffer[k-1]=inbuffer[k];
00130 }
00131 inbuffer[offset+length_maker-1]=0;
00132 this->maker = (char *)(inbuffer + offset-1);
00133 offset += length_maker;
00134 return offset;
00135 }
00136
00137 const char * getType(){ return GETMODELDESCRIPTION; };
00138 const char * getMD5(){ return "e6c55e34b143695104d37ad9b33c72c0"; };
00139
00140 };
00141
00142 class GetModelDescription {
00143 public:
00144 typedef GetModelDescriptionRequest Request;
00145 typedef GetModelDescriptionResponse Response;
00146 };
00147
00148 }
00149 #endif