GetWorldProperties.h
Go to the documentation of this file.
00001 #ifndef _ROS_SERVICE_GetWorldProperties_h
00002 #define _ROS_SERVICE_GetWorldProperties_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 
00008 namespace gazebo_msgs
00009 {
00010 
00011 static const char GETWORLDPROPERTIES[] = "gazebo_msgs/GetWorldProperties";
00012 
00013   class GetWorldPropertiesRequest : public ros::Msg
00014   {
00015     public:
00016 
00017     virtual int serialize(unsigned char *outbuffer) const
00018     {
00019       int offset = 0;
00020       return offset;
00021     }
00022 
00023     virtual int deserialize(unsigned char *inbuffer)
00024     {
00025       int offset = 0;
00026      return offset;
00027     }
00028 
00029     const char * getType(){ return GETWORLDPROPERTIES; };
00030     const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; };
00031 
00032   };
00033 
00034   class GetWorldPropertiesResponse : public ros::Msg
00035   {
00036     public:
00037       float sim_time;
00038       uint8_t model_names_length;
00039       char* st_model_names;
00040       char* * model_names;
00041       bool rendering_enabled;
00042       bool success;
00043       char * status_message;
00044 
00045     virtual int serialize(unsigned char *outbuffer) const
00046     {
00047       int offset = 0;
00048       int32_t * val_sim_time = (int32_t *) &(this->sim_time);
00049       int32_t exp_sim_time = (((*val_sim_time)>>23)&255);
00050       if(exp_sim_time != 0)
00051         exp_sim_time += 1023-127;
00052       int32_t sig_sim_time = *val_sim_time;
00053       *(outbuffer + offset++) = 0;
00054       *(outbuffer + offset++) = 0;
00055       *(outbuffer + offset++) = 0;
00056       *(outbuffer + offset++) = (sig_sim_time<<5) & 0xff;
00057       *(outbuffer + offset++) = (sig_sim_time>>3) & 0xff;
00058       *(outbuffer + offset++) = (sig_sim_time>>11) & 0xff;
00059       *(outbuffer + offset++) = ((exp_sim_time<<4) & 0xF0) | ((sig_sim_time>>19)&0x0F);
00060       *(outbuffer + offset++) = (exp_sim_time>>4) & 0x7F;
00061       if(this->sim_time < 0) *(outbuffer + offset -1) |= 0x80;
00062       *(outbuffer + offset++) = model_names_length;
00063       *(outbuffer + offset++) = 0;
00064       *(outbuffer + offset++) = 0;
00065       *(outbuffer + offset++) = 0;
00066       for( uint8_t i = 0; i < model_names_length; i++){
00067       uint32_t length_model_namesi = strlen( (const char*) this->model_names[i]);
00068       memcpy(outbuffer + offset, &length_model_namesi, sizeof(uint32_t));
00069       offset += 4;
00070       memcpy(outbuffer + offset, this->model_names[i], length_model_namesi);
00071       offset += length_model_namesi;
00072       }
00073       union {
00074         bool real;
00075         uint8_t base;
00076       } u_rendering_enabled;
00077       u_rendering_enabled.real = this->rendering_enabled;
00078       *(outbuffer + offset + 0) = (u_rendering_enabled.base >> (8 * 0)) & 0xFF;
00079       offset += sizeof(this->rendering_enabled);
00080       union {
00081         bool real;
00082         uint8_t base;
00083       } u_success;
00084       u_success.real = this->success;
00085       *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
00086       offset += sizeof(this->success);
00087       uint32_t length_status_message = strlen( (const char*) this->status_message);
00088       memcpy(outbuffer + offset, &length_status_message, sizeof(uint32_t));
00089       offset += 4;
00090       memcpy(outbuffer + offset, this->status_message, length_status_message);
00091       offset += length_status_message;
00092       return offset;
00093     }
00094 
00095     virtual int deserialize(unsigned char *inbuffer)
00096     {
00097       int offset = 0;
00098       uint32_t * val_sim_time = (uint32_t*) &(this->sim_time);
00099       offset += 3;
00100       *val_sim_time = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00101       *val_sim_time |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00102       *val_sim_time |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00103       *val_sim_time |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00104       uint32_t exp_sim_time = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00105       exp_sim_time |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00106       if(exp_sim_time !=0)
00107         *val_sim_time |= ((exp_sim_time)-1023+127)<<23;
00108       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->sim_time = -this->sim_time;
00109       uint8_t model_names_lengthT = *(inbuffer + offset++);
00110       if(model_names_lengthT > model_names_length)
00111         this->model_names = (char**)realloc(this->model_names, model_names_lengthT * sizeof(char*));
00112       offset += 3;
00113       model_names_length = model_names_lengthT;
00114       for( uint8_t i = 0; i < model_names_length; i++){
00115       uint32_t length_st_model_names;
00116       memcpy(&length_st_model_names, (inbuffer + offset), sizeof(uint32_t));
00117       offset += 4;
00118       for(unsigned int k= offset; k< offset+length_st_model_names; ++k){
00119           inbuffer[k-1]=inbuffer[k];
00120       }
00121       inbuffer[offset+length_st_model_names-1]=0;
00122       this->st_model_names = (char *)(inbuffer + offset-1);
00123       offset += length_st_model_names;
00124         memcpy( &(this->model_names[i]), &(this->st_model_names), sizeof(char*));
00125       }
00126       union {
00127         bool real;
00128         uint8_t base;
00129       } u_rendering_enabled;
00130       u_rendering_enabled.base = 0;
00131       u_rendering_enabled.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00132       this->rendering_enabled = u_rendering_enabled.real;
00133       offset += sizeof(this->rendering_enabled);
00134       union {
00135         bool real;
00136         uint8_t base;
00137       } u_success;
00138       u_success.base = 0;
00139       u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00140       this->success = u_success.real;
00141       offset += sizeof(this->success);
00142       uint32_t length_status_message;
00143       memcpy(&length_status_message, (inbuffer + offset), sizeof(uint32_t));
00144       offset += 4;
00145       for(unsigned int k= offset; k< offset+length_status_message; ++k){
00146           inbuffer[k-1]=inbuffer[k];
00147       }
00148       inbuffer[offset+length_status_message-1]=0;
00149       this->status_message = (char *)(inbuffer + offset-1);
00150       offset += length_status_message;
00151      return offset;
00152     }
00153 
00154     const char * getType(){ return GETWORLDPROPERTIES; };
00155     const char * getMD5(){ return "36bb0f2eccf4d8be971410c22818ba3f"; };
00156 
00157   };
00158 
00159   class GetWorldProperties {
00160     public:
00161     typedef GetWorldPropertiesRequest Request;
00162     typedef GetWorldPropertiesResponse Response;
00163   };
00164 
00165 }
00166 #endif


lizi_arduino
Author(s): RoboTiCan
autogenerated on Wed Aug 26 2015 12:24:22