ControllerState.h
Go to the documentation of this file.
00001 #ifndef _ROS_controller_manager_msgs_ControllerState_h
00002 #define _ROS_controller_manager_msgs_ControllerState_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace controller_manager_msgs
00010 {
00011 
00012   class ControllerState : public ros::Msg
00013   {
00014     public:
00015       const char* name;
00016       const char* state;
00017       const char* type;
00018       const char* hardware_interface;
00019       uint8_t resources_length;
00020       char* st_resources;
00021       char* * resources;
00022 
00023     virtual int serialize(unsigned char *outbuffer) const
00024     {
00025       int offset = 0;
00026       uint32_t length_name = strlen(this->name);
00027       memcpy(outbuffer + offset, &length_name, sizeof(uint32_t));
00028       offset += 4;
00029       memcpy(outbuffer + offset, this->name, length_name);
00030       offset += length_name;
00031       uint32_t length_state = strlen(this->state);
00032       memcpy(outbuffer + offset, &length_state, sizeof(uint32_t));
00033       offset += 4;
00034       memcpy(outbuffer + offset, this->state, length_state);
00035       offset += length_state;
00036       uint32_t length_type = strlen(this->type);
00037       memcpy(outbuffer + offset, &length_type, sizeof(uint32_t));
00038       offset += 4;
00039       memcpy(outbuffer + offset, this->type, length_type);
00040       offset += length_type;
00041       uint32_t length_hardware_interface = strlen(this->hardware_interface);
00042       memcpy(outbuffer + offset, &length_hardware_interface, sizeof(uint32_t));
00043       offset += 4;
00044       memcpy(outbuffer + offset, this->hardware_interface, length_hardware_interface);
00045       offset += length_hardware_interface;
00046       *(outbuffer + offset++) = resources_length;
00047       *(outbuffer + offset++) = 0;
00048       *(outbuffer + offset++) = 0;
00049       *(outbuffer + offset++) = 0;
00050       for( uint8_t i = 0; i < resources_length; i++){
00051       uint32_t length_resourcesi = strlen(this->resources[i]);
00052       memcpy(outbuffer + offset, &length_resourcesi, sizeof(uint32_t));
00053       offset += 4;
00054       memcpy(outbuffer + offset, this->resources[i], length_resourcesi);
00055       offset += length_resourcesi;
00056       }
00057       return offset;
00058     }
00059 
00060     virtual int deserialize(unsigned char *inbuffer)
00061     {
00062       int offset = 0;
00063       uint32_t length_name;
00064       memcpy(&length_name, (inbuffer + offset), sizeof(uint32_t));
00065       offset += 4;
00066       for(unsigned int k= offset; k< offset+length_name; ++k){
00067           inbuffer[k-1]=inbuffer[k];
00068       }
00069       inbuffer[offset+length_name-1]=0;
00070       this->name = (char *)(inbuffer + offset-1);
00071       offset += length_name;
00072       uint32_t length_state;
00073       memcpy(&length_state, (inbuffer + offset), sizeof(uint32_t));
00074       offset += 4;
00075       for(unsigned int k= offset; k< offset+length_state; ++k){
00076           inbuffer[k-1]=inbuffer[k];
00077       }
00078       inbuffer[offset+length_state-1]=0;
00079       this->state = (char *)(inbuffer + offset-1);
00080       offset += length_state;
00081       uint32_t length_type;
00082       memcpy(&length_type, (inbuffer + offset), sizeof(uint32_t));
00083       offset += 4;
00084       for(unsigned int k= offset; k< offset+length_type; ++k){
00085           inbuffer[k-1]=inbuffer[k];
00086       }
00087       inbuffer[offset+length_type-1]=0;
00088       this->type = (char *)(inbuffer + offset-1);
00089       offset += length_type;
00090       uint32_t length_hardware_interface;
00091       memcpy(&length_hardware_interface, (inbuffer + offset), sizeof(uint32_t));
00092       offset += 4;
00093       for(unsigned int k= offset; k< offset+length_hardware_interface; ++k){
00094           inbuffer[k-1]=inbuffer[k];
00095       }
00096       inbuffer[offset+length_hardware_interface-1]=0;
00097       this->hardware_interface = (char *)(inbuffer + offset-1);
00098       offset += length_hardware_interface;
00099       uint8_t resources_lengthT = *(inbuffer + offset++);
00100       if(resources_lengthT > resources_length)
00101         this->resources = (char**)realloc(this->resources, resources_lengthT * sizeof(char*));
00102       offset += 3;
00103       resources_length = resources_lengthT;
00104       for( uint8_t i = 0; i < resources_length; i++){
00105       uint32_t length_st_resources;
00106       memcpy(&length_st_resources, (inbuffer + offset), sizeof(uint32_t));
00107       offset += 4;
00108       for(unsigned int k= offset; k< offset+length_st_resources; ++k){
00109           inbuffer[k-1]=inbuffer[k];
00110       }
00111       inbuffer[offset+length_st_resources-1]=0;
00112       this->st_resources = (char *)(inbuffer + offset-1);
00113       offset += length_st_resources;
00114         memcpy( &(this->resources[i]), &(this->st_resources), sizeof(char*));
00115       }
00116      return offset;
00117     }
00118 
00119     const char * getType(){ return "controller_manager_msgs/ControllerState"; };
00120     const char * getMD5(){ return "cac963cc68f4f5836765c108de0fc446"; };
00121 
00122   };
00123 
00124 }
00125 #endif


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