Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: rosserial_mbed_hello_world_publisher_jade
Diff: topic_tools/MuxList.h
- Revision:
- 0:a906bb7c7831
diff -r 000000000000 -r a906bb7c7831 topic_tools/MuxList.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/topic_tools/MuxList.h Thu Mar 31 23:23:15 2016 +0000
@@ -0,0 +1,102 @@
+#ifndef _ROS_SERVICE_MuxList_h
+#define _ROS_SERVICE_MuxList_h
+#include <stdint.h>
+#include <string.h>
+#include <stdlib.h>
+#include "ros/msg.h"
+
+namespace topic_tools
+{
+
+static const char MUXLIST[] = "topic_tools/MuxList";
+
+ class MuxListRequest : public ros::Msg
+ {
+ public:
+
+ MuxListRequest()
+ {
+ }
+
+ virtual int serialize(unsigned char *outbuffer) const
+ {
+ int offset = 0;
+ return offset;
+ }
+
+ virtual int deserialize(unsigned char *inbuffer)
+ {
+ int offset = 0;
+ return offset;
+ }
+
+ const char * getType(){ return MUXLIST; };
+ const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; };
+
+ };
+
+ class MuxListResponse : public ros::Msg
+ {
+ public:
+ uint8_t topics_length;
+ char* st_topics;
+ char* * topics;
+
+ MuxListResponse():
+ topics_length(0), topics(NULL)
+ {
+ }
+
+ virtual int serialize(unsigned char *outbuffer) const
+ {
+ int offset = 0;
+ *(outbuffer + offset++) = topics_length;
+ *(outbuffer + offset++) = 0;
+ *(outbuffer + offset++) = 0;
+ *(outbuffer + offset++) = 0;
+ for( uint8_t i = 0; i < topics_length; i++){
+ uint32_t length_topicsi = strlen(this->topics[i]);
+ memcpy(outbuffer + offset, &length_topicsi, sizeof(uint32_t));
+ offset += 4;
+ memcpy(outbuffer + offset, this->topics[i], length_topicsi);
+ offset += length_topicsi;
+ }
+ return offset;
+ }
+
+ virtual int deserialize(unsigned char *inbuffer)
+ {
+ int offset = 0;
+ uint8_t topics_lengthT = *(inbuffer + offset++);
+ if(topics_lengthT > topics_length)
+ this->topics = (char**)realloc(this->topics, topics_lengthT * sizeof(char*));
+ offset += 3;
+ topics_length = topics_lengthT;
+ for( uint8_t i = 0; i < topics_length; i++){
+ uint32_t length_st_topics;
+ memcpy(&length_st_topics, (inbuffer + offset), sizeof(uint32_t));
+ offset += 4;
+ for(unsigned int k= offset; k< offset+length_st_topics; ++k){
+ inbuffer[k-1]=inbuffer[k];
+ }
+ inbuffer[offset+length_st_topics-1]=0;
+ this->st_topics = (char *)(inbuffer + offset-1);
+ offset += length_st_topics;
+ memcpy( &(this->topics[i]), &(this->st_topics), sizeof(char*));
+ }
+ return offset;
+ }
+
+ const char * getType(){ return MUXLIST; };
+ const char * getMD5(){ return "b0eef9a05d4e829092fc2f2c3c2aad3d"; };
+
+ };
+
+ class MuxList {
+ public:
+ typedef MuxListRequest Request;
+ typedef MuxListResponse Response;
+ };
+
+}
+#endif