Working towards recieving twists

Dependencies:   BufferedSerial

Fork of ros_lib_kinetic by Gary Servin

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MuxSelect.h Source File

MuxSelect.h

00001 #ifndef _ROS_SERVICE_MuxSelect_h
00002 #define _ROS_SERVICE_MuxSelect_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 MUXSELECT[] = "topic_tools/MuxSelect";
00012 
00013   class MuxSelectRequest : public ros::Msg
00014   {
00015     public:
00016       typedef const char* _topic_type;
00017       _topic_type topic;
00018 
00019     MuxSelectRequest():
00020       topic("")
00021     {
00022     }
00023 
00024     virtual int serialize(unsigned char *outbuffer) const
00025     {
00026       int offset = 0;
00027       uint32_t length_topic = strlen(this->topic);
00028       varToArr(outbuffer + offset, length_topic);
00029       offset += 4;
00030       memcpy(outbuffer + offset, this->topic, length_topic);
00031       offset += length_topic;
00032       return offset;
00033     }
00034 
00035     virtual int deserialize(unsigned char *inbuffer)
00036     {
00037       int offset = 0;
00038       uint32_t length_topic;
00039       arrToVar(length_topic, (inbuffer + offset));
00040       offset += 4;
00041       for(unsigned int k= offset; k< offset+length_topic; ++k){
00042           inbuffer[k-1]=inbuffer[k];
00043       }
00044       inbuffer[offset+length_topic-1]=0;
00045       this->topic = (char *)(inbuffer + offset-1);
00046       offset += length_topic;
00047      return offset;
00048     }
00049 
00050     const char * getType(){ return MUXSELECT; };
00051     const char * getMD5(){ return "d8f94bae31b356b24d0427f80426d0c3"; };
00052 
00053   };
00054 
00055   class MuxSelectResponse : public ros::Msg
00056   {
00057     public:
00058       typedef const char* _prev_topic_type;
00059       _prev_topic_type prev_topic;
00060 
00061     MuxSelectResponse():
00062       prev_topic("")
00063     {
00064     }
00065 
00066     virtual int serialize(unsigned char *outbuffer) const
00067     {
00068       int offset = 0;
00069       uint32_t length_prev_topic = strlen(this->prev_topic);
00070       varToArr(outbuffer + offset, length_prev_topic);
00071       offset += 4;
00072       memcpy(outbuffer + offset, this->prev_topic, length_prev_topic);
00073       offset += length_prev_topic;
00074       return offset;
00075     }
00076 
00077     virtual int deserialize(unsigned char *inbuffer)
00078     {
00079       int offset = 0;
00080       uint32_t length_prev_topic;
00081       arrToVar(length_prev_topic, (inbuffer + offset));
00082       offset += 4;
00083       for(unsigned int k= offset; k< offset+length_prev_topic; ++k){
00084           inbuffer[k-1]=inbuffer[k];
00085       }
00086       inbuffer[offset+length_prev_topic-1]=0;
00087       this->prev_topic = (char *)(inbuffer + offset-1);
00088       offset += length_prev_topic;
00089      return offset;
00090     }
00091 
00092     const char * getType(){ return MUXSELECT; };
00093     const char * getMD5(){ return "3db0a473debdbafea387c9e49358c320"; };
00094 
00095   };
00096 
00097   class MuxSelect {
00098     public:
00099     typedef MuxSelectRequest Request;
00100     typedef MuxSelectResponse Response;
00101   };
00102 
00103 }
00104 #endif