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.
Fork of rosserial_mbed_lib by
tf/FrameGraph.h@3:1cf99502f396, 2011-11-12 (annotated)
- Committer:
- nucho
- Date:
- Sat Nov 12 23:54:45 2011 +0000
- Revision:
- 3:1cf99502f396
- Parent:
- 0:77afd7560544
This program supported the revision of 167 of rosserial.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| nucho | 3:1cf99502f396 | 1 | #ifndef _ROS_SERVICE_FrameGraph_h |
| nucho | 3:1cf99502f396 | 2 | #define _ROS_SERVICE_FrameGraph_h |
| nucho | 0:77afd7560544 | 3 | #include <stdint.h> |
| nucho | 0:77afd7560544 | 4 | #include <string.h> |
| nucho | 0:77afd7560544 | 5 | #include <stdlib.h> |
| nucho | 3:1cf99502f396 | 6 | #include "ros/msg.h" |
| nucho | 0:77afd7560544 | 7 | |
| nucho | 0:77afd7560544 | 8 | namespace tf |
| nucho | 0:77afd7560544 | 9 | { |
| nucho | 0:77afd7560544 | 10 | |
| nucho | 0:77afd7560544 | 11 | static const char FRAMEGRAPH[] = "tf/FrameGraph"; |
| nucho | 0:77afd7560544 | 12 | |
| nucho | 0:77afd7560544 | 13 | class FrameGraphRequest : public ros::Msg |
| nucho | 0:77afd7560544 | 14 | { |
| nucho | 0:77afd7560544 | 15 | public: |
| nucho | 0:77afd7560544 | 16 | |
| nucho | 3:1cf99502f396 | 17 | virtual int serialize(unsigned char *outbuffer) const |
| nucho | 0:77afd7560544 | 18 | { |
| nucho | 0:77afd7560544 | 19 | int offset = 0; |
| nucho | 0:77afd7560544 | 20 | return offset; |
| nucho | 0:77afd7560544 | 21 | } |
| nucho | 0:77afd7560544 | 22 | |
| nucho | 0:77afd7560544 | 23 | virtual int deserialize(unsigned char *inbuffer) |
| nucho | 0:77afd7560544 | 24 | { |
| nucho | 0:77afd7560544 | 25 | int offset = 0; |
| nucho | 0:77afd7560544 | 26 | return offset; |
| nucho | 0:77afd7560544 | 27 | } |
| nucho | 0:77afd7560544 | 28 | |
| nucho | 3:1cf99502f396 | 29 | virtual const char * getType(){ return FRAMEGRAPH; }; |
| nucho | 3:1cf99502f396 | 30 | virtual const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; }; |
| nucho | 0:77afd7560544 | 31 | |
| nucho | 0:77afd7560544 | 32 | }; |
| nucho | 0:77afd7560544 | 33 | |
| nucho | 0:77afd7560544 | 34 | class FrameGraphResponse : public ros::Msg |
| nucho | 0:77afd7560544 | 35 | { |
| nucho | 0:77afd7560544 | 36 | public: |
| nucho | 0:77afd7560544 | 37 | char * dot_graph; |
| nucho | 0:77afd7560544 | 38 | |
| nucho | 3:1cf99502f396 | 39 | virtual int serialize(unsigned char *outbuffer) const |
| nucho | 0:77afd7560544 | 40 | { |
| nucho | 0:77afd7560544 | 41 | int offset = 0; |
| nucho | 3:1cf99502f396 | 42 | uint32_t * length_dot_graph = (uint32_t *)(outbuffer + offset); |
| nucho | 0:77afd7560544 | 43 | *length_dot_graph = strlen( (const char*) this->dot_graph); |
| nucho | 0:77afd7560544 | 44 | offset += 4; |
| nucho | 0:77afd7560544 | 45 | memcpy(outbuffer + offset, this->dot_graph, *length_dot_graph); |
| nucho | 0:77afd7560544 | 46 | offset += *length_dot_graph; |
| nucho | 0:77afd7560544 | 47 | return offset; |
| nucho | 0:77afd7560544 | 48 | } |
| nucho | 0:77afd7560544 | 49 | |
| nucho | 0:77afd7560544 | 50 | virtual int deserialize(unsigned char *inbuffer) |
| nucho | 0:77afd7560544 | 51 | { |
| nucho | 0:77afd7560544 | 52 | int offset = 0; |
| nucho | 0:77afd7560544 | 53 | uint32_t length_dot_graph = *(uint32_t *)(inbuffer + offset); |
| nucho | 0:77afd7560544 | 54 | offset += 4; |
| nucho | 0:77afd7560544 | 55 | for(unsigned int k= offset; k< offset+length_dot_graph; ++k){ |
| nucho | 0:77afd7560544 | 56 | inbuffer[k-1]=inbuffer[k]; |
| nucho | 3:1cf99502f396 | 57 | } |
| nucho | 0:77afd7560544 | 58 | inbuffer[offset+length_dot_graph-1]=0; |
| nucho | 0:77afd7560544 | 59 | this->dot_graph = (char *)(inbuffer + offset-1); |
| nucho | 0:77afd7560544 | 60 | offset += length_dot_graph; |
| nucho | 0:77afd7560544 | 61 | return offset; |
| nucho | 0:77afd7560544 | 62 | } |
| nucho | 0:77afd7560544 | 63 | |
| nucho | 3:1cf99502f396 | 64 | virtual const char * getType(){ return FRAMEGRAPH; }; |
| nucho | 3:1cf99502f396 | 65 | virtual const char * getMD5(){ return "c4af9ac907e58e906eb0b6e3c58478c0"; }; |
| nucho | 3:1cf99502f396 | 66 | |
| nucho | 3:1cf99502f396 | 67 | }; |
| nucho | 0:77afd7560544 | 68 | |
| nucho | 3:1cf99502f396 | 69 | class FrameGraph { |
| nucho | 3:1cf99502f396 | 70 | public: |
| nucho | 3:1cf99502f396 | 71 | typedef FrameGraphRequest Request; |
| nucho | 3:1cf99502f396 | 72 | typedef FrameGraphResponse Response; |
| nucho | 0:77afd7560544 | 73 | }; |
| nucho | 0:77afd7560544 | 74 | |
| nucho | 0:77afd7560544 | 75 | } |
| nucho | 0:77afd7560544 | 76 | #endif |
