StartController.h
Go to the documentation of this file.
00001 #ifndef _ROS_SERVICE_StartController_h
00002 #define _ROS_SERVICE_StartController_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 
00008 namespace dynamixel_controllers
00009 {
00010 
00011 static const char STARTCONTROLLER[] = "dynamixel_controllers/StartController";
00012 
00013   class StartControllerRequest : public ros::Msg
00014   {
00015     public:
00016       const char* port_name;
00017       const char* package_path;
00018       const char* module_name;
00019       const char* class_name;
00020       const char* controller_name;
00021       uint8_t dependencies_length;
00022       char* st_dependencies;
00023       char* * dependencies;
00024 
00025     virtual int serialize(unsigned char *outbuffer) const
00026     {
00027       int offset = 0;
00028       uint32_t length_port_name = strlen(this->port_name);
00029       memcpy(outbuffer + offset, &length_port_name, sizeof(uint32_t));
00030       offset += 4;
00031       memcpy(outbuffer + offset, this->port_name, length_port_name);
00032       offset += length_port_name;
00033       uint32_t length_package_path = strlen(this->package_path);
00034       memcpy(outbuffer + offset, &length_package_path, sizeof(uint32_t));
00035       offset += 4;
00036       memcpy(outbuffer + offset, this->package_path, length_package_path);
00037       offset += length_package_path;
00038       uint32_t length_module_name = strlen(this->module_name);
00039       memcpy(outbuffer + offset, &length_module_name, sizeof(uint32_t));
00040       offset += 4;
00041       memcpy(outbuffer + offset, this->module_name, length_module_name);
00042       offset += length_module_name;
00043       uint32_t length_class_name = strlen(this->class_name);
00044       memcpy(outbuffer + offset, &length_class_name, sizeof(uint32_t));
00045       offset += 4;
00046       memcpy(outbuffer + offset, this->class_name, length_class_name);
00047       offset += length_class_name;
00048       uint32_t length_controller_name = strlen(this->controller_name);
00049       memcpy(outbuffer + offset, &length_controller_name, sizeof(uint32_t));
00050       offset += 4;
00051       memcpy(outbuffer + offset, this->controller_name, length_controller_name);
00052       offset += length_controller_name;
00053       *(outbuffer + offset++) = dependencies_length;
00054       *(outbuffer + offset++) = 0;
00055       *(outbuffer + offset++) = 0;
00056       *(outbuffer + offset++) = 0;
00057       for( uint8_t i = 0; i < dependencies_length; i++){
00058       uint32_t length_dependenciesi = strlen(this->dependencies[i]);
00059       memcpy(outbuffer + offset, &length_dependenciesi, sizeof(uint32_t));
00060       offset += 4;
00061       memcpy(outbuffer + offset, this->dependencies[i], length_dependenciesi);
00062       offset += length_dependenciesi;
00063       }
00064       return offset;
00065     }
00066 
00067     virtual int deserialize(unsigned char *inbuffer)
00068     {
00069       int offset = 0;
00070       uint32_t length_port_name;
00071       memcpy(&length_port_name, (inbuffer + offset), sizeof(uint32_t));
00072       offset += 4;
00073       for(unsigned int k= offset; k< offset+length_port_name; ++k){
00074           inbuffer[k-1]=inbuffer[k];
00075       }
00076       inbuffer[offset+length_port_name-1]=0;
00077       this->port_name = (char *)(inbuffer + offset-1);
00078       offset += length_port_name;
00079       uint32_t length_package_path;
00080       memcpy(&length_package_path, (inbuffer + offset), sizeof(uint32_t));
00081       offset += 4;
00082       for(unsigned int k= offset; k< offset+length_package_path; ++k){
00083           inbuffer[k-1]=inbuffer[k];
00084       }
00085       inbuffer[offset+length_package_path-1]=0;
00086       this->package_path = (char *)(inbuffer + offset-1);
00087       offset += length_package_path;
00088       uint32_t length_module_name;
00089       memcpy(&length_module_name, (inbuffer + offset), sizeof(uint32_t));
00090       offset += 4;
00091       for(unsigned int k= offset; k< offset+length_module_name; ++k){
00092           inbuffer[k-1]=inbuffer[k];
00093       }
00094       inbuffer[offset+length_module_name-1]=0;
00095       this->module_name = (char *)(inbuffer + offset-1);
00096       offset += length_module_name;
00097       uint32_t length_class_name;
00098       memcpy(&length_class_name, (inbuffer + offset), sizeof(uint32_t));
00099       offset += 4;
00100       for(unsigned int k= offset; k< offset+length_class_name; ++k){
00101           inbuffer[k-1]=inbuffer[k];
00102       }
00103       inbuffer[offset+length_class_name-1]=0;
00104       this->class_name = (char *)(inbuffer + offset-1);
00105       offset += length_class_name;
00106       uint32_t length_controller_name;
00107       memcpy(&length_controller_name, (inbuffer + offset), sizeof(uint32_t));
00108       offset += 4;
00109       for(unsigned int k= offset; k< offset+length_controller_name; ++k){
00110           inbuffer[k-1]=inbuffer[k];
00111       }
00112       inbuffer[offset+length_controller_name-1]=0;
00113       this->controller_name = (char *)(inbuffer + offset-1);
00114       offset += length_controller_name;
00115       uint8_t dependencies_lengthT = *(inbuffer + offset++);
00116       if(dependencies_lengthT > dependencies_length)
00117         this->dependencies = (char**)realloc(this->dependencies, dependencies_lengthT * sizeof(char*));
00118       offset += 3;
00119       dependencies_length = dependencies_lengthT;
00120       for( uint8_t i = 0; i < dependencies_length; i++){
00121       uint32_t length_st_dependencies;
00122       memcpy(&length_st_dependencies, (inbuffer + offset), sizeof(uint32_t));
00123       offset += 4;
00124       for(unsigned int k= offset; k< offset+length_st_dependencies; ++k){
00125           inbuffer[k-1]=inbuffer[k];
00126       }
00127       inbuffer[offset+length_st_dependencies-1]=0;
00128       this->st_dependencies = (char *)(inbuffer + offset-1);
00129       offset += length_st_dependencies;
00130         memcpy( &(this->dependencies[i]), &(this->st_dependencies), sizeof(char*));
00131       }
00132      return offset;
00133     }
00134 
00135     const char * getType(){ return STARTCONTROLLER; };
00136     const char * getMD5(){ return "7785d708c83a180befd2fe3450dd9d41"; };
00137 
00138   };
00139 
00140   class StartControllerResponse : public ros::Msg
00141   {
00142     public:
00143       bool success;
00144       const char* reason;
00145 
00146     virtual int serialize(unsigned char *outbuffer) const
00147     {
00148       int offset = 0;
00149       union {
00150         bool real;
00151         uint8_t base;
00152       } u_success;
00153       u_success.real = this->success;
00154       *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
00155       offset += sizeof(this->success);
00156       uint32_t length_reason = strlen(this->reason);
00157       memcpy(outbuffer + offset, &length_reason, sizeof(uint32_t));
00158       offset += 4;
00159       memcpy(outbuffer + offset, this->reason, length_reason);
00160       offset += length_reason;
00161       return offset;
00162     }
00163 
00164     virtual int deserialize(unsigned char *inbuffer)
00165     {
00166       int offset = 0;
00167       union {
00168         bool real;
00169         uint8_t base;
00170       } u_success;
00171       u_success.base = 0;
00172       u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00173       this->success = u_success.real;
00174       offset += sizeof(this->success);
00175       uint32_t length_reason;
00176       memcpy(&length_reason, (inbuffer + offset), sizeof(uint32_t));
00177       offset += 4;
00178       for(unsigned int k= offset; k< offset+length_reason; ++k){
00179           inbuffer[k-1]=inbuffer[k];
00180       }
00181       inbuffer[offset+length_reason-1]=0;
00182       this->reason = (char *)(inbuffer + offset-1);
00183       offset += length_reason;
00184      return offset;
00185     }
00186 
00187     const char * getType(){ return STARTCONTROLLER; };
00188     const char * getMD5(){ return "a4d50a34d34f18de48e2436ff1472594"; };
00189 
00190   };
00191 
00192   class StartController {
00193     public:
00194     typedef StartControllerRequest Request;
00195     typedef StartControllerResponse Response;
00196   };
00197 
00198 }
00199 #endif


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