root / quad2 / arduino / src / ros_lib / std_msgs / UInt64.h @ c1426757
History | View | Annotate | Download (1.44 KB)
1 | c1426757 | Tom Mullins | #ifndef _ROS_std_msgs_UInt64_h
|
---|---|---|---|
2 | #define _ROS_std_msgs_UInt64_h
|
||
3 | |||
4 | #include <stdint.h> |
||
5 | #include <string.h> |
||
6 | #include <stdlib.h> |
||
7 | #include "ros/msg.h" |
||
8 | |||
9 | namespace std_msgs |
||
10 | { |
||
11 | |||
12 | class UInt64 : public ros::Msg |
||
13 | { |
||
14 | public:
|
||
15 | uint64_t data; |
||
16 | |||
17 | virtual int serialize(unsigned char *outbuffer) const |
||
18 | { |
||
19 | int offset = 0; |
||
20 | union {
|
||
21 | uint64_t real; |
||
22 | uint32_t base; |
||
23 | } u_data; |
||
24 | u_data.real = this->data; |
||
25 | *(outbuffer + offset + 0) = (u_data.base >> (8 * 0)) & 0xFF; |
||
26 | *(outbuffer + offset + 1) = (u_data.base >> (8 * 1)) & 0xFF; |
||
27 | *(outbuffer + offset + 2) = (u_data.base >> (8 * 2)) & 0xFF; |
||
28 | *(outbuffer + offset + 3) = (u_data.base >> (8 * 3)) & 0xFF; |
||
29 | offset += sizeof(this->data);
|
||
30 | return offset;
|
||
31 | } |
||
32 | |||
33 | virtual int deserialize(unsigned char *inbuffer) |
||
34 | { |
||
35 | int offset = 0; |
||
36 | union {
|
||
37 | uint64_t real; |
||
38 | uint32_t base; |
||
39 | } u_data; |
||
40 | u_data.base = 0;
|
||
41 | u_data.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
||
42 | u_data.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
||
43 | u_data.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
||
44 | u_data.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
||
45 | this->data = u_data.real; |
||
46 | offset += sizeof(this->data);
|
||
47 | return offset;
|
||
48 | } |
||
49 | |||
50 | const char * getType(){ return "std_msgs/UInt64"; }; |
||
51 | const char * getMD5(){ return "1b2a79973e8bf53d7b53acb71299cb57"; }; |
||
52 | |||
53 | }; |
||
54 | |||
55 | } |
||
56 | #endif |