SpawnModel.h
Go to the documentation of this file.
00001 #ifndef _ROS_SERVICE_SpawnModel_h
00002 #define _ROS_SERVICE_SpawnModel_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 #include "geometry_msgs/Pose.h"
00008 
00009 namespace gazebo_msgs
00010 {
00011 
00012 static const char SPAWNMODEL[] = "gazebo_msgs/SpawnModel";
00013 
00014   class SpawnModelRequest : public ros::Msg
00015   {
00016     public:
00017       const char* model_name;
00018       const char* model_xml;
00019       const char* robot_namespace;
00020       geometry_msgs::Pose initial_pose;
00021       const char* reference_frame;
00022 
00023     virtual int serialize(unsigned char *outbuffer) const
00024     {
00025       int offset = 0;
00026       uint32_t length_model_name = strlen(this->model_name);
00027       memcpy(outbuffer + offset, &length_model_name, sizeof(uint32_t));
00028       offset += 4;
00029       memcpy(outbuffer + offset, this->model_name, length_model_name);
00030       offset += length_model_name;
00031       uint32_t length_model_xml = strlen(this->model_xml);
00032       memcpy(outbuffer + offset, &length_model_xml, sizeof(uint32_t));
00033       offset += 4;
00034       memcpy(outbuffer + offset, this->model_xml, length_model_xml);
00035       offset += length_model_xml;
00036       uint32_t length_robot_namespace = strlen(this->robot_namespace);
00037       memcpy(outbuffer + offset, &length_robot_namespace, sizeof(uint32_t));
00038       offset += 4;
00039       memcpy(outbuffer + offset, this->robot_namespace, length_robot_namespace);
00040       offset += length_robot_namespace;
00041       offset += this->initial_pose.serialize(outbuffer + offset);
00042       uint32_t length_reference_frame = strlen(this->reference_frame);
00043       memcpy(outbuffer + offset, &length_reference_frame, sizeof(uint32_t));
00044       offset += 4;
00045       memcpy(outbuffer + offset, this->reference_frame, length_reference_frame);
00046       offset += length_reference_frame;
00047       return offset;
00048     }
00049 
00050     virtual int deserialize(unsigned char *inbuffer)
00051     {
00052       int offset = 0;
00053       uint32_t length_model_name;
00054       memcpy(&length_model_name, (inbuffer + offset), sizeof(uint32_t));
00055       offset += 4;
00056       for(unsigned int k= offset; k< offset+length_model_name; ++k){
00057           inbuffer[k-1]=inbuffer[k];
00058       }
00059       inbuffer[offset+length_model_name-1]=0;
00060       this->model_name = (char *)(inbuffer + offset-1);
00061       offset += length_model_name;
00062       uint32_t length_model_xml;
00063       memcpy(&length_model_xml, (inbuffer + offset), sizeof(uint32_t));
00064       offset += 4;
00065       for(unsigned int k= offset; k< offset+length_model_xml; ++k){
00066           inbuffer[k-1]=inbuffer[k];
00067       }
00068       inbuffer[offset+length_model_xml-1]=0;
00069       this->model_xml = (char *)(inbuffer + offset-1);
00070       offset += length_model_xml;
00071       uint32_t length_robot_namespace;
00072       memcpy(&length_robot_namespace, (inbuffer + offset), sizeof(uint32_t));
00073       offset += 4;
00074       for(unsigned int k= offset; k< offset+length_robot_namespace; ++k){
00075           inbuffer[k-1]=inbuffer[k];
00076       }
00077       inbuffer[offset+length_robot_namespace-1]=0;
00078       this->robot_namespace = (char *)(inbuffer + offset-1);
00079       offset += length_robot_namespace;
00080       offset += this->initial_pose.deserialize(inbuffer + offset);
00081       uint32_t length_reference_frame;
00082       memcpy(&length_reference_frame, (inbuffer + offset), sizeof(uint32_t));
00083       offset += 4;
00084       for(unsigned int k= offset; k< offset+length_reference_frame; ++k){
00085           inbuffer[k-1]=inbuffer[k];
00086       }
00087       inbuffer[offset+length_reference_frame-1]=0;
00088       this->reference_frame = (char *)(inbuffer + offset-1);
00089       offset += length_reference_frame;
00090      return offset;
00091     }
00092 
00093     const char * getType(){ return SPAWNMODEL; };
00094     const char * getMD5(){ return "6d0eba5753761cd57e6263a056b79930"; };
00095 
00096   };
00097 
00098   class SpawnModelResponse : public ros::Msg
00099   {
00100     public:
00101       bool success;
00102       const char* status_message;
00103 
00104     virtual int serialize(unsigned char *outbuffer) const
00105     {
00106       int offset = 0;
00107       union {
00108         bool real;
00109         uint8_t base;
00110       } u_success;
00111       u_success.real = this->success;
00112       *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
00113       offset += sizeof(this->success);
00114       uint32_t length_status_message = strlen(this->status_message);
00115       memcpy(outbuffer + offset, &length_status_message, sizeof(uint32_t));
00116       offset += 4;
00117       memcpy(outbuffer + offset, this->status_message, length_status_message);
00118       offset += length_status_message;
00119       return offset;
00120     }
00121 
00122     virtual int deserialize(unsigned char *inbuffer)
00123     {
00124       int offset = 0;
00125       union {
00126         bool real;
00127         uint8_t base;
00128       } u_success;
00129       u_success.base = 0;
00130       u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00131       this->success = u_success.real;
00132       offset += sizeof(this->success);
00133       uint32_t length_status_message;
00134       memcpy(&length_status_message, (inbuffer + offset), sizeof(uint32_t));
00135       offset += 4;
00136       for(unsigned int k= offset; k< offset+length_status_message; ++k){
00137           inbuffer[k-1]=inbuffer[k];
00138       }
00139       inbuffer[offset+length_status_message-1]=0;
00140       this->status_message = (char *)(inbuffer + offset-1);
00141       offset += length_status_message;
00142      return offset;
00143     }
00144 
00145     const char * getType(){ return SPAWNMODEL; };
00146     const char * getMD5(){ return "2ec6f3eff0161f4257b808b12bc830c2"; };
00147 
00148   };
00149 
00150   class SpawnModel {
00151     public:
00152     typedef SpawnModelRequest Request;
00153     typedef SpawnModelResponse Response;
00154   };
00155 
00156 }
00157 #endif


ric_mc
Author(s): RoboTiCan
autogenerated on Thu Aug 27 2015 14:39:50