root / quad2 / arduino / src / ros_lib / tf / FrameGraph.h @ c1426757
History | View | Annotate | Download (1.75 KB)
1 |
#ifndef _ROS_SERVICE_FrameGraph_h
|
---|---|
2 |
#define _ROS_SERVICE_FrameGraph_h
|
3 |
#include <stdint.h> |
4 |
#include <string.h> |
5 |
#include <stdlib.h> |
6 |
#include "ros/msg.h" |
7 |
|
8 |
namespace tf |
9 |
{ |
10 |
|
11 |
static const char FRAMEGRAPH[] = "tf/FrameGraph"; |
12 |
|
13 |
class FrameGraphRequest : public ros::Msg |
14 |
{ |
15 |
public:
|
16 |
|
17 |
virtual int serialize(unsigned char *outbuffer) const |
18 |
{ |
19 |
int offset = 0; |
20 |
return offset;
|
21 |
} |
22 |
|
23 |
virtual int deserialize(unsigned char *inbuffer) |
24 |
{ |
25 |
int offset = 0; |
26 |
return offset;
|
27 |
} |
28 |
|
29 |
const char * getType(){ return FRAMEGRAPH; }; |
30 |
const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; }; |
31 |
|
32 |
}; |
33 |
|
34 |
class FrameGraphResponse : public ros::Msg |
35 |
{ |
36 |
public:
|
37 |
char * dot_graph;
|
38 |
|
39 |
virtual int serialize(unsigned char *outbuffer) const |
40 |
{ |
41 |
int offset = 0; |
42 |
uint32_t * length_dot_graph = (uint32_t *)(outbuffer + offset); |
43 |
*length_dot_graph = strlen( (const char*) this->dot_graph); |
44 |
offset += 4;
|
45 |
memcpy(outbuffer + offset, this->dot_graph, *length_dot_graph); |
46 |
offset += *length_dot_graph; |
47 |
return offset;
|
48 |
} |
49 |
|
50 |
virtual int deserialize(unsigned char *inbuffer) |
51 |
{ |
52 |
int offset = 0; |
53 |
uint32_t length_dot_graph = *(uint32_t *)(inbuffer + offset); |
54 |
offset += 4;
|
55 |
for(unsigned int k= offset; k< offset+length_dot_graph; ++k){ |
56 |
inbuffer[k-1]=inbuffer[k];
|
57 |
} |
58 |
inbuffer[offset+length_dot_graph-1]=0; |
59 |
this->dot_graph = (char *)(inbuffer + offset-1); |
60 |
offset += length_dot_graph; |
61 |
return offset;
|
62 |
} |
63 |
|
64 |
const char * getType(){ return FRAMEGRAPH; }; |
65 |
const char * getMD5(){ return "c4af9ac907e58e906eb0b6e3c58478c0"; }; |
66 |
|
67 |
}; |
68 |
|
69 |
class FrameGraph { |
70 |
public:
|
71 |
typedef FrameGraphRequest Request;
|
72 |
typedef FrameGraphResponse Response;
|
73 |
}; |
74 |
|
75 |
} |
76 |
#endif
|