MuxList.h
Go to the documentation of this file.
00001 #ifndef _ROS_SERVICE_MuxList_h
00002 #define _ROS_SERVICE_MuxList_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 
00008 namespace topic_tools
00009 {
00010 
00011 static const char MUXLIST[] = "topic_tools/MuxList";
00012 
00013   class MuxListRequest : 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 MUXLIST; };
00030     const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; };
00031 
00032   };
00033 
00034   class MuxListResponse : public ros::Msg
00035   {
00036     public:
00037       uint8_t topics_length;
00038       char* st_topics;
00039       char* * topics;
00040 
00041     virtual int serialize(unsigned char *outbuffer) const
00042     {
00043       int offset = 0;
00044       *(outbuffer + offset++) = topics_length;
00045       *(outbuffer + offset++) = 0;
00046       *(outbuffer + offset++) = 0;
00047       *(outbuffer + offset++) = 0;
00048       for( uint8_t i = 0; i < topics_length; i++){
00049       uint32_t length_topicsi = strlen(this->topics[i]);
00050       memcpy(outbuffer + offset, &length_topicsi, sizeof(uint32_t));
00051       offset += 4;
00052       memcpy(outbuffer + offset, this->topics[i], length_topicsi);
00053       offset += length_topicsi;
00054       }
00055       return offset;
00056     }
00057 
00058     virtual int deserialize(unsigned char *inbuffer)
00059     {
00060       int offset = 0;
00061       uint8_t topics_lengthT = *(inbuffer + offset++);
00062       if(topics_lengthT > topics_length)
00063         this->topics = (char**)realloc(this->topics, topics_lengthT * sizeof(char*));
00064       offset += 3;
00065       topics_length = topics_lengthT;
00066       for( uint8_t i = 0; i < topics_length; i++){
00067       uint32_t length_st_topics;
00068       memcpy(&length_st_topics, (inbuffer + offset), sizeof(uint32_t));
00069       offset += 4;
00070       for(unsigned int k= offset; k< offset+length_st_topics; ++k){
00071           inbuffer[k-1]=inbuffer[k];
00072       }
00073       inbuffer[offset+length_st_topics-1]=0;
00074       this->st_topics = (char *)(inbuffer + offset-1);
00075       offset += length_st_topics;
00076         memcpy( &(this->topics[i]), &(this->st_topics), sizeof(char*));
00077       }
00078      return offset;
00079     }
00080 
00081     const char * getType(){ return MUXLIST; };
00082     const char * getMD5(){ return "b0eef9a05d4e829092fc2f2c3c2aad3d"; };
00083 
00084   };
00085 
00086   class MuxList {
00087     public:
00088     typedef MuxListRequest Request;
00089     typedef MuxListResponse Response;
00090   };
00091 
00092 }
00093 #endif


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