Statistics
| Branch: | Revision:

root / quad2 / arduino / src / ros_lib / topic_tools / MuxAdd.h @ c1426757

History | View | Annotate | Download (1.67 KB)

1
#ifndef _ROS_SERVICE_MuxAdd_h
2
#define _ROS_SERVICE_MuxAdd_h
3
#include <stdint.h>
4
#include <string.h>
5
#include <stdlib.h>
6
#include "ros/msg.h"
7

    
8
namespace topic_tools
9
{
10

    
11
static const char MUXADD[] = "topic_tools/MuxAdd";
12

    
13
  class MuxAddRequest : public ros::Msg
14
  {
15
    public:
16
      char * topic;
17

    
18
    virtual int serialize(unsigned char *outbuffer) const
19
    {
20
      int offset = 0;
21
      uint32_t * length_topic = (uint32_t *)(outbuffer + offset);
22
      *length_topic = strlen( (const char*) this->topic);
23
      offset += 4;
24
      memcpy(outbuffer + offset, this->topic, *length_topic);
25
      offset += *length_topic;
26
      return offset;
27
    }
28

    
29
    virtual int deserialize(unsigned char *inbuffer)
30
    {
31
      int offset = 0;
32
      uint32_t length_topic = *(uint32_t *)(inbuffer + offset);
33
      offset += 4;
34
      for(unsigned int k= offset; k< offset+length_topic; ++k){
35
          inbuffer[k-1]=inbuffer[k];
36
      }
37
      inbuffer[offset+length_topic-1]=0;
38
      this->topic = (char *)(inbuffer + offset-1);
39
      offset += length_topic;
40
     return offset;
41
    }
42

    
43
    const char * getType(){ return MUXADD; };
44
    const char * getMD5(){ return "d8f94bae31b356b24d0427f80426d0c3"; };
45

    
46
  };
47

    
48
  class MuxAddResponse : public ros::Msg
49
  {
50
    public:
51

    
52
    virtual int serialize(unsigned char *outbuffer) const
53
    {
54
      int offset = 0;
55
      return offset;
56
    }
57

    
58
    virtual int deserialize(unsigned char *inbuffer)
59
    {
60
      int offset = 0;
61
     return offset;
62
    }
63

    
64
    const char * getType(){ return MUXADD; };
65
    const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; };
66

    
67
  };
68

    
69
  class MuxAdd {
70
    public:
71
    typedef MuxAddRequest Request;
72
    typedef MuxAddResponse Response;
73
  };
74

    
75
}
76
#endif