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.
ros_lib/std_msgs/Int16.h@0:8f3710bfd298, 2020-09-02 (annotated)
- Committer:
- irfantitok
- Date:
- Wed Sep 02 13:51:31 2020 +0000
- Revision:
- 0:8f3710bfd298
Resolved round not found
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
irfantitok | 0:8f3710bfd298 | 1 | #ifndef _ROS_std_msgs_Int16_h |
irfantitok | 0:8f3710bfd298 | 2 | #define _ROS_std_msgs_Int16_h |
irfantitok | 0:8f3710bfd298 | 3 | |
irfantitok | 0:8f3710bfd298 | 4 | #include <stdint.h> |
irfantitok | 0:8f3710bfd298 | 5 | #include <string.h> |
irfantitok | 0:8f3710bfd298 | 6 | #include <stdlib.h> |
irfantitok | 0:8f3710bfd298 | 7 | #include "ros/msg.h" |
irfantitok | 0:8f3710bfd298 | 8 | |
irfantitok | 0:8f3710bfd298 | 9 | namespace std_msgs |
irfantitok | 0:8f3710bfd298 | 10 | { |
irfantitok | 0:8f3710bfd298 | 11 | |
irfantitok | 0:8f3710bfd298 | 12 | class Int16 : public ros::Msg |
irfantitok | 0:8f3710bfd298 | 13 | { |
irfantitok | 0:8f3710bfd298 | 14 | public: |
irfantitok | 0:8f3710bfd298 | 15 | typedef int16_t _data_type; |
irfantitok | 0:8f3710bfd298 | 16 | _data_type data; |
irfantitok | 0:8f3710bfd298 | 17 | |
irfantitok | 0:8f3710bfd298 | 18 | Int16(): |
irfantitok | 0:8f3710bfd298 | 19 | data(0) |
irfantitok | 0:8f3710bfd298 | 20 | { |
irfantitok | 0:8f3710bfd298 | 21 | } |
irfantitok | 0:8f3710bfd298 | 22 | |
irfantitok | 0:8f3710bfd298 | 23 | virtual int serialize(unsigned char *outbuffer) const |
irfantitok | 0:8f3710bfd298 | 24 | { |
irfantitok | 0:8f3710bfd298 | 25 | int offset = 0; |
irfantitok | 0:8f3710bfd298 | 26 | union { |
irfantitok | 0:8f3710bfd298 | 27 | int16_t real; |
irfantitok | 0:8f3710bfd298 | 28 | uint16_t base; |
irfantitok | 0:8f3710bfd298 | 29 | } u_data; |
irfantitok | 0:8f3710bfd298 | 30 | u_data.real = this->data; |
irfantitok | 0:8f3710bfd298 | 31 | *(outbuffer + offset + 0) = (u_data.base >> (8 * 0)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 32 | *(outbuffer + offset + 1) = (u_data.base >> (8 * 1)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 33 | offset += sizeof(this->data); |
irfantitok | 0:8f3710bfd298 | 34 | return offset; |
irfantitok | 0:8f3710bfd298 | 35 | } |
irfantitok | 0:8f3710bfd298 | 36 | |
irfantitok | 0:8f3710bfd298 | 37 | virtual int deserialize(unsigned char *inbuffer) |
irfantitok | 0:8f3710bfd298 | 38 | { |
irfantitok | 0:8f3710bfd298 | 39 | int offset = 0; |
irfantitok | 0:8f3710bfd298 | 40 | union { |
irfantitok | 0:8f3710bfd298 | 41 | int16_t real; |
irfantitok | 0:8f3710bfd298 | 42 | uint16_t base; |
irfantitok | 0:8f3710bfd298 | 43 | } u_data; |
irfantitok | 0:8f3710bfd298 | 44 | u_data.base = 0; |
irfantitok | 0:8f3710bfd298 | 45 | u_data.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0); |
irfantitok | 0:8f3710bfd298 | 46 | u_data.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); |
irfantitok | 0:8f3710bfd298 | 47 | this->data = u_data.real; |
irfantitok | 0:8f3710bfd298 | 48 | offset += sizeof(this->data); |
irfantitok | 0:8f3710bfd298 | 49 | return offset; |
irfantitok | 0:8f3710bfd298 | 50 | } |
irfantitok | 0:8f3710bfd298 | 51 | |
irfantitok | 0:8f3710bfd298 | 52 | const char * getType(){ return "std_msgs/Int16"; }; |
irfantitok | 0:8f3710bfd298 | 53 | const char * getMD5(){ return "8524586e34fbd7cb1c08c5f5f1ca0e57"; }; |
irfantitok | 0:8f3710bfd298 | 54 | |
irfantitok | 0:8f3710bfd298 | 55 | }; |
irfantitok | 0:8f3710bfd298 | 56 | |
irfantitok | 0:8f3710bfd298 | 57 | } |
irfantitok | 0:8f3710bfd298 | 58 | #endif |