Go to the documentation of this file.00001 #ifndef _ROS_SERVICE_GetModelList_h
00002 #define _ROS_SERVICE_GetModelList_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 GETMODELLIST[] = "household_objects_database_msgs/GetModelList";
00013
00014 class GetModelListRequest : public ros::Msg
00015 {
00016 public:
00017 const char* model_set;
00018
00019 virtual int serialize(unsigned char *outbuffer) const
00020 {
00021 int offset = 0;
00022 uint32_t length_model_set = strlen(this->model_set);
00023 memcpy(outbuffer + offset, &length_model_set, sizeof(uint32_t));
00024 offset += 4;
00025 memcpy(outbuffer + offset, this->model_set, length_model_set);
00026 offset += length_model_set;
00027 return offset;
00028 }
00029
00030 virtual int deserialize(unsigned char *inbuffer)
00031 {
00032 int offset = 0;
00033 uint32_t length_model_set;
00034 memcpy(&length_model_set, (inbuffer + offset), sizeof(uint32_t));
00035 offset += 4;
00036 for(unsigned int k= offset; k< offset+length_model_set; ++k){
00037 inbuffer[k-1]=inbuffer[k];
00038 }
00039 inbuffer[offset+length_model_set-1]=0;
00040 this->model_set = (char *)(inbuffer + offset-1);
00041 offset += length_model_set;
00042 return offset;
00043 }
00044
00045 const char * getType(){ return GETMODELLIST; };
00046 const char * getMD5(){ return "6bdf0a866151f41b8876e73800929933"; };
00047
00048 };
00049
00050 class GetModelListResponse : public ros::Msg
00051 {
00052 public:
00053 household_objects_database_msgs::DatabaseReturnCode return_code;
00054 uint8_t model_ids_length;
00055 int32_t st_model_ids;
00056 int32_t * model_ids;
00057
00058 virtual int serialize(unsigned char *outbuffer) const
00059 {
00060 int offset = 0;
00061 offset += this->return_code.serialize(outbuffer + offset);
00062 *(outbuffer + offset++) = model_ids_length;
00063 *(outbuffer + offset++) = 0;
00064 *(outbuffer + offset++) = 0;
00065 *(outbuffer + offset++) = 0;
00066 for( uint8_t i = 0; i < model_ids_length; i++){
00067 union {
00068 int32_t real;
00069 uint32_t base;
00070 } u_model_idsi;
00071 u_model_idsi.real = this->model_ids[i];
00072 *(outbuffer + offset + 0) = (u_model_idsi.base >> (8 * 0)) & 0xFF;
00073 *(outbuffer + offset + 1) = (u_model_idsi.base >> (8 * 1)) & 0xFF;
00074 *(outbuffer + offset + 2) = (u_model_idsi.base >> (8 * 2)) & 0xFF;
00075 *(outbuffer + offset + 3) = (u_model_idsi.base >> (8 * 3)) & 0xFF;
00076 offset += sizeof(this->model_ids[i]);
00077 }
00078 return offset;
00079 }
00080
00081 virtual int deserialize(unsigned char *inbuffer)
00082 {
00083 int offset = 0;
00084 offset += this->return_code.deserialize(inbuffer + offset);
00085 uint8_t model_ids_lengthT = *(inbuffer + offset++);
00086 if(model_ids_lengthT > model_ids_length)
00087 this->model_ids = (int32_t*)realloc(this->model_ids, model_ids_lengthT * sizeof(int32_t));
00088 offset += 3;
00089 model_ids_length = model_ids_lengthT;
00090 for( uint8_t i = 0; i < model_ids_length; i++){
00091 union {
00092 int32_t real;
00093 uint32_t base;
00094 } u_st_model_ids;
00095 u_st_model_ids.base = 0;
00096 u_st_model_ids.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00097 u_st_model_ids.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00098 u_st_model_ids.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00099 u_st_model_ids.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00100 this->st_model_ids = u_st_model_ids.real;
00101 offset += sizeof(this->st_model_ids);
00102 memcpy( &(this->model_ids[i]), &(this->st_model_ids), sizeof(int32_t));
00103 }
00104 return offset;
00105 }
00106
00107 const char * getType(){ return GETMODELLIST; };
00108 const char * getMD5(){ return "81fac8c5d631e612bd9183a923572d53"; };
00109
00110 };
00111
00112 class GetModelList {
00113 public:
00114 typedef GetModelListRequest Request;
00115 typedef GetModelListResponse Response;
00116 };
00117
00118 }
00119 #endif