rosserial for Hydro
Fork of rosserial_mbed_lib by
std_msgs/UInt64.h@0:77afd7560544, 2011-08-19 (annotated)
- Committer:
- nucho
- Date:
- Fri Aug 19 09:06:30 2011 +0000
- Revision:
- 0:77afd7560544
- Child:
- 1:ff0ec969dad1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nucho | 0:77afd7560544 | 1 | #ifndef ros_UInt64_h |
nucho | 0:77afd7560544 | 2 | #define ros_UInt64_h |
nucho | 0:77afd7560544 | 3 | |
nucho | 0:77afd7560544 | 4 | #include <stdint.h> |
nucho | 0:77afd7560544 | 5 | #include <string.h> |
nucho | 0:77afd7560544 | 6 | #include <stdlib.h> |
nucho | 0:77afd7560544 | 7 | #include "../ros/msg.h" |
nucho | 0:77afd7560544 | 8 | |
nucho | 0:77afd7560544 | 9 | namespace std_msgs |
nucho | 0:77afd7560544 | 10 | { |
nucho | 0:77afd7560544 | 11 | |
nucho | 0:77afd7560544 | 12 | class UInt64 : public ros::Msg |
nucho | 0:77afd7560544 | 13 | { |
nucho | 0:77afd7560544 | 14 | public: |
nucho | 0:77afd7560544 | 15 | long data; |
nucho | 0:77afd7560544 | 16 | |
nucho | 0:77afd7560544 | 17 | virtual int serialize(unsigned char *outbuffer) |
nucho | 0:77afd7560544 | 18 | { |
nucho | 0:77afd7560544 | 19 | int offset = 0; |
nucho | 0:77afd7560544 | 20 | *(outbuffer + offset++) = (data >> (8 * 0)) & 0xFF; |
nucho | 0:77afd7560544 | 21 | *(outbuffer + offset++) = (data >> (8 * 1)) & 0xFF; |
nucho | 0:77afd7560544 | 22 | *(outbuffer + offset++) = (data >> (8 * 2)) & 0xFF; |
nucho | 0:77afd7560544 | 23 | *(outbuffer + offset++) = (data >> (8 * 3)) & 0xFF; |
nucho | 0:77afd7560544 | 24 | *(outbuffer + offset++) = (data > 0) ? 0: 255; |
nucho | 0:77afd7560544 | 25 | *(outbuffer + offset++) = (data > 0) ? 0: 255; |
nucho | 0:77afd7560544 | 26 | *(outbuffer + offset++) = (data > 0) ? 0: 255; |
nucho | 0:77afd7560544 | 27 | *(outbuffer + offset++) = (data > 0) ? 0: 255; |
nucho | 0:77afd7560544 | 28 | return offset; |
nucho | 0:77afd7560544 | 29 | } |
nucho | 0:77afd7560544 | 30 | |
nucho | 0:77afd7560544 | 31 | virtual int deserialize(unsigned char *inbuffer) |
nucho | 0:77afd7560544 | 32 | { |
nucho | 0:77afd7560544 | 33 | int offset = 0; |
nucho | 0:77afd7560544 | 34 | data = 0; |
nucho | 0:77afd7560544 | 35 | data += ((long)(*(inbuffer + offset++))) >> (8 * 0); |
nucho | 0:77afd7560544 | 36 | data += ((long)(*(inbuffer + offset++))) >> (8 * 1); |
nucho | 0:77afd7560544 | 37 | data += ((long)(*(inbuffer + offset++))) >> (8 * 2); |
nucho | 0:77afd7560544 | 38 | data += ((long)(*(inbuffer + offset++))) >> (8 * 3); |
nucho | 0:77afd7560544 | 39 | offset += 4; |
nucho | 0:77afd7560544 | 40 | return offset; |
nucho | 0:77afd7560544 | 41 | } |
nucho | 0:77afd7560544 | 42 | |
nucho | 0:77afd7560544 | 43 | virtual const char * getType(){ return "std_msgs/UInt64"; }; |
nucho | 0:77afd7560544 | 44 | |
nucho | 0:77afd7560544 | 45 | }; |
nucho | 0:77afd7560544 | 46 | |
nucho | 0:77afd7560544 | 47 | } |
nucho | 0:77afd7560544 | 48 | #endif |