Go to the documentation of this file.00001 #ifndef _ROS_SERVICE_ListControllers_h
00002 #define _ROS_SERVICE_ListControllers_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 LISTCONTROLLERS[] = "pr2_mechanism_msgs/ListControllers";
00012
00013 class ListControllersRequest : 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 LISTCONTROLLERS; };
00030 const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; };
00031
00032 };
00033
00034 class ListControllersResponse : public ros::Msg
00035 {
00036 public:
00037 uint8_t controllers_length;
00038 char* st_controllers;
00039 char* * controllers;
00040 uint8_t state_length;
00041 char* st_state;
00042 char* * state;
00043
00044 virtual int serialize(unsigned char *outbuffer) const
00045 {
00046 int offset = 0;
00047 *(outbuffer + offset++) = controllers_length;
00048 *(outbuffer + offset++) = 0;
00049 *(outbuffer + offset++) = 0;
00050 *(outbuffer + offset++) = 0;
00051 for( uint8_t i = 0; i < controllers_length; i++){
00052 uint32_t length_controllersi = strlen(this->controllers[i]);
00053 memcpy(outbuffer + offset, &length_controllersi, sizeof(uint32_t));
00054 offset += 4;
00055 memcpy(outbuffer + offset, this->controllers[i], length_controllersi);
00056 offset += length_controllersi;
00057 }
00058 *(outbuffer + offset++) = state_length;
00059 *(outbuffer + offset++) = 0;
00060 *(outbuffer + offset++) = 0;
00061 *(outbuffer + offset++) = 0;
00062 for( uint8_t i = 0; i < state_length; i++){
00063 uint32_t length_statei = strlen(this->state[i]);
00064 memcpy(outbuffer + offset, &length_statei, sizeof(uint32_t));
00065 offset += 4;
00066 memcpy(outbuffer + offset, this->state[i], length_statei);
00067 offset += length_statei;
00068 }
00069 return offset;
00070 }
00071
00072 virtual int deserialize(unsigned char *inbuffer)
00073 {
00074 int offset = 0;
00075 uint8_t controllers_lengthT = *(inbuffer + offset++);
00076 if(controllers_lengthT > controllers_length)
00077 this->controllers = (char**)realloc(this->controllers, controllers_lengthT * sizeof(char*));
00078 offset += 3;
00079 controllers_length = controllers_lengthT;
00080 for( uint8_t i = 0; i < controllers_length; i++){
00081 uint32_t length_st_controllers;
00082 memcpy(&length_st_controllers, (inbuffer + offset), sizeof(uint32_t));
00083 offset += 4;
00084 for(unsigned int k= offset; k< offset+length_st_controllers; ++k){
00085 inbuffer[k-1]=inbuffer[k];
00086 }
00087 inbuffer[offset+length_st_controllers-1]=0;
00088 this->st_controllers = (char *)(inbuffer + offset-1);
00089 offset += length_st_controllers;
00090 memcpy( &(this->controllers[i]), &(this->st_controllers), sizeof(char*));
00091 }
00092 uint8_t state_lengthT = *(inbuffer + offset++);
00093 if(state_lengthT > state_length)
00094 this->state = (char**)realloc(this->state, state_lengthT * sizeof(char*));
00095 offset += 3;
00096 state_length = state_lengthT;
00097 for( uint8_t i = 0; i < state_length; i++){
00098 uint32_t length_st_state;
00099 memcpy(&length_st_state, (inbuffer + offset), sizeof(uint32_t));
00100 offset += 4;
00101 for(unsigned int k= offset; k< offset+length_st_state; ++k){
00102 inbuffer[k-1]=inbuffer[k];
00103 }
00104 inbuffer[offset+length_st_state-1]=0;
00105 this->st_state = (char *)(inbuffer + offset-1);
00106 offset += length_st_state;
00107 memcpy( &(this->state[i]), &(this->st_state), sizeof(char*));
00108 }
00109 return offset;
00110 }
00111
00112 const char * getType(){ return LISTCONTROLLERS; };
00113 const char * getMD5(){ return "39c8d39516aed5c7d76284ac06c220e5"; };
00114
00115 };
00116
00117 class ListControllers {
00118 public:
00119 typedef ListControllersRequest Request;
00120 typedef ListControllersResponse Response;
00121 };
00122
00123 }
00124 #endif