Soft robot team / ros_lib_melodic

Dependents:   Robot_team1_QEI_Douglas Robot_team1

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GetLightProperties.h Source File

GetLightProperties.h

00001 #ifndef _ROS_SERVICE_GetLightProperties_h
00002 #define _ROS_SERVICE_GetLightProperties_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 #include "std_msgs/ColorRGBA.h"
00008 
00009 namespace gazebo_msgs
00010 {
00011 
00012 static const char GETLIGHTPROPERTIES[] = "gazebo_msgs/GetLightProperties";
00013 
00014   class GetLightPropertiesRequest : public ros::Msg
00015   {
00016     public:
00017       typedef const char* _light_name_type;
00018       _light_name_type light_name;
00019 
00020     GetLightPropertiesRequest():
00021       light_name("")
00022     {
00023     }
00024 
00025     virtual int serialize(unsigned char *outbuffer) const
00026     {
00027       int offset = 0;
00028       uint32_t length_light_name = strlen(this->light_name);
00029       varToArr(outbuffer + offset, length_light_name);
00030       offset += 4;
00031       memcpy(outbuffer + offset, this->light_name, length_light_name);
00032       offset += length_light_name;
00033       return offset;
00034     }
00035 
00036     virtual int deserialize(unsigned char *inbuffer)
00037     {
00038       int offset = 0;
00039       uint32_t length_light_name;
00040       arrToVar(length_light_name, (inbuffer + offset));
00041       offset += 4;
00042       for(unsigned int k= offset; k< offset+length_light_name; ++k){
00043           inbuffer[k-1]=inbuffer[k];
00044       }
00045       inbuffer[offset+length_light_name-1]=0;
00046       this->light_name = (char *)(inbuffer + offset-1);
00047       offset += length_light_name;
00048      return offset;
00049     }
00050 
00051     const char * getType(){ return GETLIGHTPROPERTIES; };
00052     const char * getMD5(){ return "4fb676dfb4741fc866365702a859441c"; };
00053 
00054   };
00055 
00056   class GetLightPropertiesResponse : public ros::Msg
00057   {
00058     public:
00059       typedef std_msgs::ColorRGBA _diffuse_type;
00060       _diffuse_type diffuse;
00061       typedef double _attenuation_constant_type;
00062       _attenuation_constant_type attenuation_constant;
00063       typedef double _attenuation_linear_type;
00064       _attenuation_linear_type attenuation_linear;
00065       typedef double _attenuation_quadratic_type;
00066       _attenuation_quadratic_type attenuation_quadratic;
00067       typedef bool _success_type;
00068       _success_type success;
00069       typedef const char* _status_message_type;
00070       _status_message_type status_message;
00071 
00072     GetLightPropertiesResponse():
00073       diffuse(),
00074       attenuation_constant(0),
00075       attenuation_linear(0),
00076       attenuation_quadratic(0),
00077       success(0),
00078       status_message("")
00079     {
00080     }
00081 
00082     virtual int serialize(unsigned char *outbuffer) const
00083     {
00084       int offset = 0;
00085       offset += this->diffuse.serialize(outbuffer + offset);
00086       union {
00087         double real;
00088         uint64_t base;
00089       } u_attenuation_constant;
00090       u_attenuation_constant.real = this->attenuation_constant;
00091       *(outbuffer + offset + 0) = (u_attenuation_constant.base >> (8 * 0)) & 0xFF;
00092       *(outbuffer + offset + 1) = (u_attenuation_constant.base >> (8 * 1)) & 0xFF;
00093       *(outbuffer + offset + 2) = (u_attenuation_constant.base >> (8 * 2)) & 0xFF;
00094       *(outbuffer + offset + 3) = (u_attenuation_constant.base >> (8 * 3)) & 0xFF;
00095       *(outbuffer + offset + 4) = (u_attenuation_constant.base >> (8 * 4)) & 0xFF;
00096       *(outbuffer + offset + 5) = (u_attenuation_constant.base >> (8 * 5)) & 0xFF;
00097       *(outbuffer + offset + 6) = (u_attenuation_constant.base >> (8 * 6)) & 0xFF;
00098       *(outbuffer + offset + 7) = (u_attenuation_constant.base >> (8 * 7)) & 0xFF;
00099       offset += sizeof(this->attenuation_constant);
00100       union {
00101         double real;
00102         uint64_t base;
00103       } u_attenuation_linear;
00104       u_attenuation_linear.real = this->attenuation_linear;
00105       *(outbuffer + offset + 0) = (u_attenuation_linear.base >> (8 * 0)) & 0xFF;
00106       *(outbuffer + offset + 1) = (u_attenuation_linear.base >> (8 * 1)) & 0xFF;
00107       *(outbuffer + offset + 2) = (u_attenuation_linear.base >> (8 * 2)) & 0xFF;
00108       *(outbuffer + offset + 3) = (u_attenuation_linear.base >> (8 * 3)) & 0xFF;
00109       *(outbuffer + offset + 4) = (u_attenuation_linear.base >> (8 * 4)) & 0xFF;
00110       *(outbuffer + offset + 5) = (u_attenuation_linear.base >> (8 * 5)) & 0xFF;
00111       *(outbuffer + offset + 6) = (u_attenuation_linear.base >> (8 * 6)) & 0xFF;
00112       *(outbuffer + offset + 7) = (u_attenuation_linear.base >> (8 * 7)) & 0xFF;
00113       offset += sizeof(this->attenuation_linear);
00114       union {
00115         double real;
00116         uint64_t base;
00117       } u_attenuation_quadratic;
00118       u_attenuation_quadratic.real = this->attenuation_quadratic;
00119       *(outbuffer + offset + 0) = (u_attenuation_quadratic.base >> (8 * 0)) & 0xFF;
00120       *(outbuffer + offset + 1) = (u_attenuation_quadratic.base >> (8 * 1)) & 0xFF;
00121       *(outbuffer + offset + 2) = (u_attenuation_quadratic.base >> (8 * 2)) & 0xFF;
00122       *(outbuffer + offset + 3) = (u_attenuation_quadratic.base >> (8 * 3)) & 0xFF;
00123       *(outbuffer + offset + 4) = (u_attenuation_quadratic.base >> (8 * 4)) & 0xFF;
00124       *(outbuffer + offset + 5) = (u_attenuation_quadratic.base >> (8 * 5)) & 0xFF;
00125       *(outbuffer + offset + 6) = (u_attenuation_quadratic.base >> (8 * 6)) & 0xFF;
00126       *(outbuffer + offset + 7) = (u_attenuation_quadratic.base >> (8 * 7)) & 0xFF;
00127       offset += sizeof(this->attenuation_quadratic);
00128       union {
00129         bool real;
00130         uint8_t base;
00131       } u_success;
00132       u_success.real = this->success;
00133       *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
00134       offset += sizeof(this->success);
00135       uint32_t length_status_message = strlen(this->status_message);
00136       varToArr(outbuffer + offset, length_status_message);
00137       offset += 4;
00138       memcpy(outbuffer + offset, this->status_message, length_status_message);
00139       offset += length_status_message;
00140       return offset;
00141     }
00142 
00143     virtual int deserialize(unsigned char *inbuffer)
00144     {
00145       int offset = 0;
00146       offset += this->diffuse.deserialize(inbuffer + offset);
00147       union {
00148         double real;
00149         uint64_t base;
00150       } u_attenuation_constant;
00151       u_attenuation_constant.base = 0;
00152       u_attenuation_constant.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00153       u_attenuation_constant.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00154       u_attenuation_constant.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00155       u_attenuation_constant.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00156       u_attenuation_constant.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00157       u_attenuation_constant.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00158       u_attenuation_constant.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00159       u_attenuation_constant.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00160       this->attenuation_constant = u_attenuation_constant.real;
00161       offset += sizeof(this->attenuation_constant);
00162       union {
00163         double real;
00164         uint64_t base;
00165       } u_attenuation_linear;
00166       u_attenuation_linear.base = 0;
00167       u_attenuation_linear.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00168       u_attenuation_linear.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00169       u_attenuation_linear.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00170       u_attenuation_linear.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00171       u_attenuation_linear.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00172       u_attenuation_linear.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00173       u_attenuation_linear.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00174       u_attenuation_linear.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00175       this->attenuation_linear = u_attenuation_linear.real;
00176       offset += sizeof(this->attenuation_linear);
00177       union {
00178         double real;
00179         uint64_t base;
00180       } u_attenuation_quadratic;
00181       u_attenuation_quadratic.base = 0;
00182       u_attenuation_quadratic.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00183       u_attenuation_quadratic.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00184       u_attenuation_quadratic.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00185       u_attenuation_quadratic.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00186       u_attenuation_quadratic.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00187       u_attenuation_quadratic.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00188       u_attenuation_quadratic.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00189       u_attenuation_quadratic.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00190       this->attenuation_quadratic = u_attenuation_quadratic.real;
00191       offset += sizeof(this->attenuation_quadratic);
00192       union {
00193         bool real;
00194         uint8_t base;
00195       } u_success;
00196       u_success.base = 0;
00197       u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00198       this->success = u_success.real;
00199       offset += sizeof(this->success);
00200       uint32_t length_status_message;
00201       arrToVar(length_status_message, (inbuffer + offset));
00202       offset += 4;
00203       for(unsigned int k= offset; k< offset+length_status_message; ++k){
00204           inbuffer[k-1]=inbuffer[k];
00205       }
00206       inbuffer[offset+length_status_message-1]=0;
00207       this->status_message = (char *)(inbuffer + offset-1);
00208       offset += length_status_message;
00209      return offset;
00210     }
00211 
00212     const char * getType(){ return GETLIGHTPROPERTIES; };
00213     const char * getMD5(){ return "9a19ddd5aab4c13b7643d1722c709f1f"; };
00214 
00215   };
00216 
00217   class GetLightProperties {
00218     public:
00219     typedef GetLightPropertiesRequest Request;
00220     typedef GetLightPropertiesResponse Response;
00221   };
00222 
00223 }
00224 #endif