rosserial for Hydro
Fork of rosserial_mbed_lib by
std_msgs/Bool.h@3:1cf99502f396, 2011-11-12 (annotated)
- Committer:
- nucho
- Date:
- Sat Nov 12 23:54:45 2011 +0000
- Revision:
- 3:1cf99502f396
- Parent:
- 1:ff0ec969dad1
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_std_msgs_Bool_h |
nucho | 3:1cf99502f396 | 2 | #define _ROS_std_msgs_Bool_h |
nucho | 3:1cf99502f396 | 3 | |
nucho | 3:1cf99502f396 | 4 | #include <stdint.h> |
nucho | 3:1cf99502f396 | 5 | #include <string.h> |
nucho | 3:1cf99502f396 | 6 | #include <stdlib.h> |
nucho | 3:1cf99502f396 | 7 | #include "ros/msg.h" |
nucho | 3:1cf99502f396 | 8 | |
nucho | 3:1cf99502f396 | 9 | namespace std_msgs |
nucho | 3:1cf99502f396 | 10 | { |
nucho | 3:1cf99502f396 | 11 | |
nucho | 3:1cf99502f396 | 12 | class Bool : public ros::Msg |
nucho | 3:1cf99502f396 | 13 | { |
nucho | 3:1cf99502f396 | 14 | public: |
nucho | 3:1cf99502f396 | 15 | bool data; |
nucho | 3:1cf99502f396 | 16 | |
nucho | 3:1cf99502f396 | 17 | virtual int serialize(unsigned char *outbuffer) const |
nucho | 3:1cf99502f396 | 18 | { |
nucho | 3:1cf99502f396 | 19 | int offset = 0; |
nucho | 3:1cf99502f396 | 20 | union { |
nucho | 3:1cf99502f396 | 21 | bool real; |
nucho | 3:1cf99502f396 | 22 | uint8_t base; |
nucho | 3:1cf99502f396 | 23 | } u_data; |
nucho | 3:1cf99502f396 | 24 | u_data.real = this->data; |
nucho | 3:1cf99502f396 | 25 | *(outbuffer + offset + 0) = (u_data.base >> (8 * 0)) & 0xFF; |
nucho | 3:1cf99502f396 | 26 | offset += sizeof(this->data); |
nucho | 3:1cf99502f396 | 27 | return offset; |
nucho | 3:1cf99502f396 | 28 | } |
nucho | 3:1cf99502f396 | 29 | |
nucho | 3:1cf99502f396 | 30 | virtual int deserialize(unsigned char *inbuffer) |
nucho | 3:1cf99502f396 | 31 | { |
nucho | 3:1cf99502f396 | 32 | int offset = 0; |
nucho | 3:1cf99502f396 | 33 | union { |
nucho | 3:1cf99502f396 | 34 | bool real; |
nucho | 3:1cf99502f396 | 35 | uint8_t base; |
nucho | 3:1cf99502f396 | 36 | } u_data; |
nucho | 3:1cf99502f396 | 37 | u_data.base = 0; |
nucho | 3:1cf99502f396 | 38 | u_data.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); |
nucho | 3:1cf99502f396 | 39 | this->data = u_data.real; |
nucho | 3:1cf99502f396 | 40 | offset += sizeof(this->data); |
nucho | 3:1cf99502f396 | 41 | return offset; |
nucho | 3:1cf99502f396 | 42 | } |
nucho | 3:1cf99502f396 | 43 | |
nucho | 3:1cf99502f396 | 44 | virtual const char * getType(){ return "std_msgs/Bool"; }; |
nucho | 3:1cf99502f396 | 45 | virtual const char * getMD5(){ return "8b94c1b53db61fb6aed406028ad6332a"; }; |
nucho | 3:1cf99502f396 | 46 | |
nucho | 3:1cf99502f396 | 47 | }; |
nucho | 3:1cf99502f396 | 48 | |
nucho | 3:1cf99502f396 | 49 | } |
nucho | 0:77afd7560544 | 50 | #endif |