SwitchController.h
Go to the documentation of this file.
00001 #ifndef _ROS_SERVICE_SwitchController_h
00002 #define _ROS_SERVICE_SwitchController_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 
00008 namespace pr2_mechanism_msgs
00009 {
00010 
00011 static const char SWITCHCONTROLLER[] = "pr2_mechanism_msgs/SwitchController";
00012 
00013   class SwitchControllerRequest : public ros::Msg
00014   {
00015     public:
00016       uint8_t start_controllers_length;
00017       char* st_start_controllers;
00018       char* * start_controllers;
00019       uint8_t stop_controllers_length;
00020       char* st_stop_controllers;
00021       char* * stop_controllers;
00022       int32_t strictness;
00023       enum { BEST_EFFORT = 1 };
00024       enum { STRICT = 2 };
00025 
00026     virtual int serialize(unsigned char *outbuffer) const
00027     {
00028       int offset = 0;
00029       *(outbuffer + offset++) = start_controllers_length;
00030       *(outbuffer + offset++) = 0;
00031       *(outbuffer + offset++) = 0;
00032       *(outbuffer + offset++) = 0;
00033       for( uint8_t i = 0; i < start_controllers_length; i++){
00034       uint32_t length_start_controllersi = strlen(this->start_controllers[i]);
00035       memcpy(outbuffer + offset, &length_start_controllersi, sizeof(uint32_t));
00036       offset += 4;
00037       memcpy(outbuffer + offset, this->start_controllers[i], length_start_controllersi);
00038       offset += length_start_controllersi;
00039       }
00040       *(outbuffer + offset++) = stop_controllers_length;
00041       *(outbuffer + offset++) = 0;
00042       *(outbuffer + offset++) = 0;
00043       *(outbuffer + offset++) = 0;
00044       for( uint8_t i = 0; i < stop_controllers_length; i++){
00045       uint32_t length_stop_controllersi = strlen(this->stop_controllers[i]);
00046       memcpy(outbuffer + offset, &length_stop_controllersi, sizeof(uint32_t));
00047       offset += 4;
00048       memcpy(outbuffer + offset, this->stop_controllers[i], length_stop_controllersi);
00049       offset += length_stop_controllersi;
00050       }
00051       union {
00052         int32_t real;
00053         uint32_t base;
00054       } u_strictness;
00055       u_strictness.real = this->strictness;
00056       *(outbuffer + offset + 0) = (u_strictness.base >> (8 * 0)) & 0xFF;
00057       *(outbuffer + offset + 1) = (u_strictness.base >> (8 * 1)) & 0xFF;
00058       *(outbuffer + offset + 2) = (u_strictness.base >> (8 * 2)) & 0xFF;
00059       *(outbuffer + offset + 3) = (u_strictness.base >> (8 * 3)) & 0xFF;
00060       offset += sizeof(this->strictness);
00061       return offset;
00062     }
00063 
00064     virtual int deserialize(unsigned char *inbuffer)
00065     {
00066       int offset = 0;
00067       uint8_t start_controllers_lengthT = *(inbuffer + offset++);
00068       if(start_controllers_lengthT > start_controllers_length)
00069         this->start_controllers = (char**)realloc(this->start_controllers, start_controllers_lengthT * sizeof(char*));
00070       offset += 3;
00071       start_controllers_length = start_controllers_lengthT;
00072       for( uint8_t i = 0; i < start_controllers_length; i++){
00073       uint32_t length_st_start_controllers;
00074       memcpy(&length_st_start_controllers, (inbuffer + offset), sizeof(uint32_t));
00075       offset += 4;
00076       for(unsigned int k= offset; k< offset+length_st_start_controllers; ++k){
00077           inbuffer[k-1]=inbuffer[k];
00078       }
00079       inbuffer[offset+length_st_start_controllers-1]=0;
00080       this->st_start_controllers = (char *)(inbuffer + offset-1);
00081       offset += length_st_start_controllers;
00082         memcpy( &(this->start_controllers[i]), &(this->st_start_controllers), sizeof(char*));
00083       }
00084       uint8_t stop_controllers_lengthT = *(inbuffer + offset++);
00085       if(stop_controllers_lengthT > stop_controllers_length)
00086         this->stop_controllers = (char**)realloc(this->stop_controllers, stop_controllers_lengthT * sizeof(char*));
00087       offset += 3;
00088       stop_controllers_length = stop_controllers_lengthT;
00089       for( uint8_t i = 0; i < stop_controllers_length; i++){
00090       uint32_t length_st_stop_controllers;
00091       memcpy(&length_st_stop_controllers, (inbuffer + offset), sizeof(uint32_t));
00092       offset += 4;
00093       for(unsigned int k= offset; k< offset+length_st_stop_controllers; ++k){
00094           inbuffer[k-1]=inbuffer[k];
00095       }
00096       inbuffer[offset+length_st_stop_controllers-1]=0;
00097       this->st_stop_controllers = (char *)(inbuffer + offset-1);
00098       offset += length_st_stop_controllers;
00099         memcpy( &(this->stop_controllers[i]), &(this->st_stop_controllers), sizeof(char*));
00100       }
00101       union {
00102         int32_t real;
00103         uint32_t base;
00104       } u_strictness;
00105       u_strictness.base = 0;
00106       u_strictness.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00107       u_strictness.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00108       u_strictness.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00109       u_strictness.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00110       this->strictness = u_strictness.real;
00111       offset += sizeof(this->strictness);
00112      return offset;
00113     }
00114 
00115     const char * getType(){ return SWITCHCONTROLLER; };
00116     const char * getMD5(){ return "434da54adc434a5af5743ed711fd6ba1"; };
00117 
00118   };
00119 
00120   class SwitchControllerResponse : public ros::Msg
00121   {
00122     public:
00123       bool ok;
00124 
00125     virtual int serialize(unsigned char *outbuffer) const
00126     {
00127       int offset = 0;
00128       union {
00129         bool real;
00130         uint8_t base;
00131       } u_ok;
00132       u_ok.real = this->ok;
00133       *(outbuffer + offset + 0) = (u_ok.base >> (8 * 0)) & 0xFF;
00134       offset += sizeof(this->ok);
00135       return offset;
00136     }
00137 
00138     virtual int deserialize(unsigned char *inbuffer)
00139     {
00140       int offset = 0;
00141       union {
00142         bool real;
00143         uint8_t base;
00144       } u_ok;
00145       u_ok.base = 0;
00146       u_ok.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00147       this->ok = u_ok.real;
00148       offset += sizeof(this->ok);
00149      return offset;
00150     }
00151 
00152     const char * getType(){ return SWITCHCONTROLLER; };
00153     const char * getMD5(){ return "6f6da3883749771fac40d6deb24a8c02"; };
00154 
00155   };
00156 
00157   class SwitchController {
00158     public:
00159     typedef SwitchControllerRequest Request;
00160     typedef SwitchControllerResponse Response;
00161   };
00162 
00163 }
00164 #endif


ric_mc
Author(s): RoboTiCan
autogenerated on Fri May 20 2016 03:48:56