catchrobo2022 mbed LPC1768 メインプログラム

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ListControllerTypes.h Source File

ListControllerTypes.h

00001 #ifndef _ROS_SERVICE_ListControllerTypes_h
00002 #define _ROS_SERVICE_ListControllerTypes_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 
00008 namespace controller_manager_msgs
00009 {
00010 
00011 static const char LISTCONTROLLERTYPES[] = "controller_manager_msgs/ListControllerTypes";
00012 
00013   class ListControllerTypesRequest : public ros::Msg
00014   {
00015     public:
00016 
00017     ListControllerTypesRequest()
00018     {
00019     }
00020 
00021     virtual int serialize(unsigned char *outbuffer) const
00022     {
00023       int offset = 0;
00024       return offset;
00025     }
00026 
00027     virtual int deserialize(unsigned char *inbuffer)
00028     {
00029       int offset = 0;
00030      return offset;
00031     }
00032 
00033     virtual const char * getType(){ return LISTCONTROLLERTYPES; };
00034     virtual const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; };
00035 
00036   };
00037 
00038   class ListControllerTypesResponse : public ros::Msg
00039   {
00040     public:
00041       uint32_t types_length;
00042       typedef char* _types_type;
00043       _types_type st_types;
00044       _types_type * types;
00045       uint32_t base_classes_length;
00046       typedef char* _base_classes_type;
00047       _base_classes_type st_base_classes;
00048       _base_classes_type * base_classes;
00049 
00050     ListControllerTypesResponse():
00051       types_length(0), types(NULL),
00052       base_classes_length(0), base_classes(NULL)
00053     {
00054     }
00055 
00056     virtual int serialize(unsigned char *outbuffer) const
00057     {
00058       int offset = 0;
00059       *(outbuffer + offset + 0) = (this->types_length >> (8 * 0)) & 0xFF;
00060       *(outbuffer + offset + 1) = (this->types_length >> (8 * 1)) & 0xFF;
00061       *(outbuffer + offset + 2) = (this->types_length >> (8 * 2)) & 0xFF;
00062       *(outbuffer + offset + 3) = (this->types_length >> (8 * 3)) & 0xFF;
00063       offset += sizeof(this->types_length);
00064       for( uint32_t i = 0; i < types_length; i++){
00065       uint32_t length_typesi = strlen(this->types[i]);
00066       varToArr(outbuffer + offset, length_typesi);
00067       offset += 4;
00068       memcpy(outbuffer + offset, this->types[i], length_typesi);
00069       offset += length_typesi;
00070       }
00071       *(outbuffer + offset + 0) = (this->base_classes_length >> (8 * 0)) & 0xFF;
00072       *(outbuffer + offset + 1) = (this->base_classes_length >> (8 * 1)) & 0xFF;
00073       *(outbuffer + offset + 2) = (this->base_classes_length >> (8 * 2)) & 0xFF;
00074       *(outbuffer + offset + 3) = (this->base_classes_length >> (8 * 3)) & 0xFF;
00075       offset += sizeof(this->base_classes_length);
00076       for( uint32_t i = 0; i < base_classes_length; i++){
00077       uint32_t length_base_classesi = strlen(this->base_classes[i]);
00078       varToArr(outbuffer + offset, length_base_classesi);
00079       offset += 4;
00080       memcpy(outbuffer + offset, this->base_classes[i], length_base_classesi);
00081       offset += length_base_classesi;
00082       }
00083       return offset;
00084     }
00085 
00086     virtual int deserialize(unsigned char *inbuffer)
00087     {
00088       int offset = 0;
00089       uint32_t types_lengthT = ((uint32_t) (*(inbuffer + offset))); 
00090       types_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 
00091       types_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 
00092       types_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 
00093       offset += sizeof(this->types_length);
00094       if(types_lengthT > types_length)
00095         this->types = (char**)realloc(this->types, types_lengthT * sizeof(char*));
00096       types_length = types_lengthT;
00097       for( uint32_t i = 0; i < types_length; i++){
00098       uint32_t length_st_types;
00099       arrToVar(length_st_types, (inbuffer + offset));
00100       offset += 4;
00101       for(unsigned int k= offset; k< offset+length_st_types; ++k){
00102           inbuffer[k-1]=inbuffer[k];
00103       }
00104       inbuffer[offset+length_st_types-1]=0;
00105       this->st_types = (char *)(inbuffer + offset-1);
00106       offset += length_st_types;
00107         memcpy( &(this->types[i]), &(this->st_types), sizeof(char*));
00108       }
00109       uint32_t base_classes_lengthT = ((uint32_t) (*(inbuffer + offset))); 
00110       base_classes_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 
00111       base_classes_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 
00112       base_classes_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 
00113       offset += sizeof(this->base_classes_length);
00114       if(base_classes_lengthT > base_classes_length)
00115         this->base_classes = (char**)realloc(this->base_classes, base_classes_lengthT * sizeof(char*));
00116       base_classes_length = base_classes_lengthT;
00117       for( uint32_t i = 0; i < base_classes_length; i++){
00118       uint32_t length_st_base_classes;
00119       arrToVar(length_st_base_classes, (inbuffer + offset));
00120       offset += 4;
00121       for(unsigned int k= offset; k< offset+length_st_base_classes; ++k){
00122           inbuffer[k-1]=inbuffer[k];
00123       }
00124       inbuffer[offset+length_st_base_classes-1]=0;
00125       this->st_base_classes = (char *)(inbuffer + offset-1);
00126       offset += length_st_base_classes;
00127         memcpy( &(this->base_classes[i]), &(this->st_base_classes), sizeof(char*));
00128       }
00129      return offset;
00130     }
00131 
00132     virtual const char * getType(){ return LISTCONTROLLERTYPES; };
00133     virtual const char * getMD5(){ return "c1d4cd11aefa9f97ba4aeb5b33987f4e"; };
00134 
00135   };
00136 
00137   class ListControllerTypes {
00138     public:
00139     typedef ListControllerTypesRequest Request;
00140     typedef ListControllerTypesResponse Response;
00141   };
00142 
00143 }
00144 #endif