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/UInt32MultiArray.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_UInt32MultiArray_h |
irfantitok | 0:8f3710bfd298 | 2 | #define _ROS_std_msgs_UInt32MultiArray_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 | #include "std_msgs/MultiArrayLayout.h" |
irfantitok | 0:8f3710bfd298 | 9 | |
irfantitok | 0:8f3710bfd298 | 10 | namespace std_msgs |
irfantitok | 0:8f3710bfd298 | 11 | { |
irfantitok | 0:8f3710bfd298 | 12 | |
irfantitok | 0:8f3710bfd298 | 13 | class UInt32MultiArray : public ros::Msg |
irfantitok | 0:8f3710bfd298 | 14 | { |
irfantitok | 0:8f3710bfd298 | 15 | public: |
irfantitok | 0:8f3710bfd298 | 16 | typedef std_msgs::MultiArrayLayout _layout_type; |
irfantitok | 0:8f3710bfd298 | 17 | _layout_type layout; |
irfantitok | 0:8f3710bfd298 | 18 | uint32_t data_length; |
irfantitok | 0:8f3710bfd298 | 19 | typedef uint32_t _data_type; |
irfantitok | 0:8f3710bfd298 | 20 | _data_type st_data; |
irfantitok | 0:8f3710bfd298 | 21 | _data_type * data; |
irfantitok | 0:8f3710bfd298 | 22 | |
irfantitok | 0:8f3710bfd298 | 23 | UInt32MultiArray(): |
irfantitok | 0:8f3710bfd298 | 24 | layout(), |
irfantitok | 0:8f3710bfd298 | 25 | data_length(0), data(NULL) |
irfantitok | 0:8f3710bfd298 | 26 | { |
irfantitok | 0:8f3710bfd298 | 27 | } |
irfantitok | 0:8f3710bfd298 | 28 | |
irfantitok | 0:8f3710bfd298 | 29 | virtual int serialize(unsigned char *outbuffer) const |
irfantitok | 0:8f3710bfd298 | 30 | { |
irfantitok | 0:8f3710bfd298 | 31 | int offset = 0; |
irfantitok | 0:8f3710bfd298 | 32 | offset += this->layout.serialize(outbuffer + offset); |
irfantitok | 0:8f3710bfd298 | 33 | *(outbuffer + offset + 0) = (this->data_length >> (8 * 0)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 34 | *(outbuffer + offset + 1) = (this->data_length >> (8 * 1)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 35 | *(outbuffer + offset + 2) = (this->data_length >> (8 * 2)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 36 | *(outbuffer + offset + 3) = (this->data_length >> (8 * 3)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 37 | offset += sizeof(this->data_length); |
irfantitok | 0:8f3710bfd298 | 38 | for( uint32_t i = 0; i < data_length; i++){ |
irfantitok | 0:8f3710bfd298 | 39 | *(outbuffer + offset + 0) = (this->data[i] >> (8 * 0)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 40 | *(outbuffer + offset + 1) = (this->data[i] >> (8 * 1)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 41 | *(outbuffer + offset + 2) = (this->data[i] >> (8 * 2)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 42 | *(outbuffer + offset + 3) = (this->data[i] >> (8 * 3)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 43 | offset += sizeof(this->data[i]); |
irfantitok | 0:8f3710bfd298 | 44 | } |
irfantitok | 0:8f3710bfd298 | 45 | return offset; |
irfantitok | 0:8f3710bfd298 | 46 | } |
irfantitok | 0:8f3710bfd298 | 47 | |
irfantitok | 0:8f3710bfd298 | 48 | virtual int deserialize(unsigned char *inbuffer) |
irfantitok | 0:8f3710bfd298 | 49 | { |
irfantitok | 0:8f3710bfd298 | 50 | int offset = 0; |
irfantitok | 0:8f3710bfd298 | 51 | offset += this->layout.deserialize(inbuffer + offset); |
irfantitok | 0:8f3710bfd298 | 52 | uint32_t data_lengthT = ((uint32_t) (*(inbuffer + offset))); |
irfantitok | 0:8f3710bfd298 | 53 | data_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
irfantitok | 0:8f3710bfd298 | 54 | data_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
irfantitok | 0:8f3710bfd298 | 55 | data_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
irfantitok | 0:8f3710bfd298 | 56 | offset += sizeof(this->data_length); |
irfantitok | 0:8f3710bfd298 | 57 | if(data_lengthT > data_length) |
irfantitok | 0:8f3710bfd298 | 58 | this->data = (uint32_t*)realloc(this->data, data_lengthT * sizeof(uint32_t)); |
irfantitok | 0:8f3710bfd298 | 59 | data_length = data_lengthT; |
irfantitok | 0:8f3710bfd298 | 60 | for( uint32_t i = 0; i < data_length; i++){ |
irfantitok | 0:8f3710bfd298 | 61 | this->st_data = ((uint32_t) (*(inbuffer + offset))); |
irfantitok | 0:8f3710bfd298 | 62 | this->st_data |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
irfantitok | 0:8f3710bfd298 | 63 | this->st_data |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
irfantitok | 0:8f3710bfd298 | 64 | this->st_data |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
irfantitok | 0:8f3710bfd298 | 65 | offset += sizeof(this->st_data); |
irfantitok | 0:8f3710bfd298 | 66 | memcpy( &(this->data[i]), &(this->st_data), sizeof(uint32_t)); |
irfantitok | 0:8f3710bfd298 | 67 | } |
irfantitok | 0:8f3710bfd298 | 68 | return offset; |
irfantitok | 0:8f3710bfd298 | 69 | } |
irfantitok | 0:8f3710bfd298 | 70 | |
irfantitok | 0:8f3710bfd298 | 71 | const char * getType(){ return "std_msgs/UInt32MultiArray"; }; |
irfantitok | 0:8f3710bfd298 | 72 | const char * getMD5(){ return "4d6a180abc9be191b96a7eda6c8a233d"; }; |
irfantitok | 0:8f3710bfd298 | 73 | |
irfantitok | 0:8f3710bfd298 | 74 | }; |
irfantitok | 0:8f3710bfd298 | 75 | |
irfantitok | 0:8f3710bfd298 | 76 | } |
irfantitok | 0:8f3710bfd298 | 77 | #endif |