00001 #ifndef _ROS_SERVICE_GetModelScans_h 00002 #define _ROS_SERVICE_GetModelScans_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 #include "household_objects_database_msgs/DatabaseScan.h" 00009 00010 namespace household_objects_database_msgs 00011 { 00012 00013 static const char GETMODELSCANS[] = "household_objects_database_msgs/GetModelScans"; 00014 00015 class GetModelScansRequest : public ros::Msg 00016 { 00017 public: 00018 int32_t model_id; 00019 const char* scan_source; 00020 00021 virtual int serialize(unsigned char *outbuffer) const 00022 { 00023 int offset = 0; 00024 union { 00025 int32_t real; 00026 uint32_t base; 00027 } u_model_id; 00028 u_model_id.real = this->model_id; 00029 *(outbuffer + offset + 0) = (u_model_id.base >> (8 * 0)) & 0xFF; 00030 *(outbuffer + offset + 1) = (u_model_id.base >> (8 * 1)) & 0xFF; 00031 *(outbuffer + offset + 2) = (u_model_id.base >> (8 * 2)) & 0xFF; 00032 *(outbuffer + offset + 3) = (u_model_id.base >> (8 * 3)) & 0xFF; 00033 offset += sizeof(this->model_id); 00034 uint32_t length_scan_source = strlen(this->scan_source); 00035 memcpy(outbuffer + offset, &length_scan_source, sizeof(uint32_t)); 00036 offset += 4; 00037 memcpy(outbuffer + offset, this->scan_source, length_scan_source); 00038 offset += length_scan_source; 00039 return offset; 00040 } 00041 00042 virtual int deserialize(unsigned char *inbuffer) 00043 { 00044 int offset = 0; 00045 union { 00046 int32_t real; 00047 uint32_t base; 00048 } u_model_id; 00049 u_model_id.base = 0; 00050 u_model_id.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00051 u_model_id.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00052 u_model_id.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00053 u_model_id.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00054 this->model_id = u_model_id.real; 00055 offset += sizeof(this->model_id); 00056 uint32_t length_scan_source; 00057 memcpy(&length_scan_source, (inbuffer + offset), sizeof(uint32_t)); 00058 offset += 4; 00059 for(unsigned int k= offset; k< offset+length_scan_source; ++k){ 00060 inbuffer[k-1]=inbuffer[k]; 00061 } 00062 inbuffer[offset+length_scan_source-1]=0; 00063 this->scan_source = (char *)(inbuffer + offset-1); 00064 offset += length_scan_source; 00065 return offset; 00066 } 00067 00068 const char * getType(){ return GETMODELSCANS; }; 00069 const char * getMD5(){ return "4f31b0f27ba251f6d1f17eafced83cb7"; }; 00070 00071 }; 00072 00073 class GetModelScansResponse : public ros::Msg 00074 { 00075 public: 00076 household_objects_database_msgs::DatabaseReturnCode return_code; 00077 uint8_t matching_scans_length; 00078 household_objects_database_msgs::DatabaseScan st_matching_scans; 00079 household_objects_database_msgs::DatabaseScan * matching_scans; 00080 00081 virtual int serialize(unsigned char *outbuffer) const 00082 { 00083 int offset = 0; 00084 offset += this->return_code.serialize(outbuffer + offset); 00085 *(outbuffer + offset++) = matching_scans_length; 00086 *(outbuffer + offset++) = 0; 00087 *(outbuffer + offset++) = 0; 00088 *(outbuffer + offset++) = 0; 00089 for( uint8_t i = 0; i < matching_scans_length; i++){ 00090 offset += this->matching_scans[i].serialize(outbuffer + offset); 00091 } 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 matching_scans_lengthT = *(inbuffer + offset++); 00100 if(matching_scans_lengthT > matching_scans_length) 00101 this->matching_scans = (household_objects_database_msgs::DatabaseScan*)realloc(this->matching_scans, matching_scans_lengthT * sizeof(household_objects_database_msgs::DatabaseScan)); 00102 offset += 3; 00103 matching_scans_length = matching_scans_lengthT; 00104 for( uint8_t i = 0; i < matching_scans_length; i++){ 00105 offset += this->st_matching_scans.deserialize(inbuffer + offset); 00106 memcpy( &(this->matching_scans[i]), &(this->st_matching_scans), sizeof(household_objects_database_msgs::DatabaseScan)); 00107 } 00108 return offset; 00109 } 00110 00111 const char * getType(){ return GETMODELSCANS; }; 00112 const char * getMD5(){ return "8d1bb6e95c26a5d891987d9d9195e958"; }; 00113 00114 }; 00115 00116 class GetModelScans { 00117 public: 00118 typedef GetModelScansRequest Request; 00119 typedef GetModelScansResponse Response; 00120 }; 00121 00122 } 00123 #endif