capstone_finish

Dependencies:   BufferedSerial motor_sn7544

Committer:
Jeonghoon
Date:
Tue Nov 26 15:30:27 2019 +0000
Revision:
10:ca4e4062701a
Parent:
3:2a3664dc6634
capstone finish

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jeonghoon 3:2a3664dc6634 1 #ifndef _ROS_std_msgs_MultiArrayLayout_h
Jeonghoon 3:2a3664dc6634 2 #define _ROS_std_msgs_MultiArrayLayout_h
Jeonghoon 3:2a3664dc6634 3
Jeonghoon 3:2a3664dc6634 4 #include <stdint.h>
Jeonghoon 3:2a3664dc6634 5 #include <string.h>
Jeonghoon 3:2a3664dc6634 6 #include <stdlib.h>
Jeonghoon 3:2a3664dc6634 7 #include "ros/msg.h"
Jeonghoon 3:2a3664dc6634 8 #include "std_msgs/MultiArrayDimension.h"
Jeonghoon 3:2a3664dc6634 9
Jeonghoon 3:2a3664dc6634 10 namespace std_msgs
Jeonghoon 3:2a3664dc6634 11 {
Jeonghoon 3:2a3664dc6634 12
Jeonghoon 3:2a3664dc6634 13 class MultiArrayLayout : public ros::Msg
Jeonghoon 3:2a3664dc6634 14 {
Jeonghoon 3:2a3664dc6634 15 public:
Jeonghoon 3:2a3664dc6634 16 uint32_t dim_length;
Jeonghoon 3:2a3664dc6634 17 typedef std_msgs::MultiArrayDimension _dim_type;
Jeonghoon 3:2a3664dc6634 18 _dim_type st_dim;
Jeonghoon 3:2a3664dc6634 19 _dim_type * dim;
Jeonghoon 3:2a3664dc6634 20 typedef uint32_t _data_offset_type;
Jeonghoon 3:2a3664dc6634 21 _data_offset_type data_offset;
Jeonghoon 3:2a3664dc6634 22
Jeonghoon 3:2a3664dc6634 23 MultiArrayLayout():
Jeonghoon 3:2a3664dc6634 24 dim_length(0), dim(NULL),
Jeonghoon 3:2a3664dc6634 25 data_offset(0)
Jeonghoon 3:2a3664dc6634 26 {
Jeonghoon 3:2a3664dc6634 27 }
Jeonghoon 3:2a3664dc6634 28
Jeonghoon 3:2a3664dc6634 29 virtual int serialize(unsigned char *outbuffer) const
Jeonghoon 3:2a3664dc6634 30 {
Jeonghoon 3:2a3664dc6634 31 int offset = 0;
Jeonghoon 3:2a3664dc6634 32 *(outbuffer + offset + 0) = (this->dim_length >> (8 * 0)) & 0xFF;
Jeonghoon 3:2a3664dc6634 33 *(outbuffer + offset + 1) = (this->dim_length >> (8 * 1)) & 0xFF;
Jeonghoon 3:2a3664dc6634 34 *(outbuffer + offset + 2) = (this->dim_length >> (8 * 2)) & 0xFF;
Jeonghoon 3:2a3664dc6634 35 *(outbuffer + offset + 3) = (this->dim_length >> (8 * 3)) & 0xFF;
Jeonghoon 3:2a3664dc6634 36 offset += sizeof(this->dim_length);
Jeonghoon 3:2a3664dc6634 37 for( uint32_t i = 0; i < dim_length; i++){
Jeonghoon 3:2a3664dc6634 38 offset += this->dim[i].serialize(outbuffer + offset);
Jeonghoon 3:2a3664dc6634 39 }
Jeonghoon 3:2a3664dc6634 40 *(outbuffer + offset + 0) = (this->data_offset >> (8 * 0)) & 0xFF;
Jeonghoon 3:2a3664dc6634 41 *(outbuffer + offset + 1) = (this->data_offset >> (8 * 1)) & 0xFF;
Jeonghoon 3:2a3664dc6634 42 *(outbuffer + offset + 2) = (this->data_offset >> (8 * 2)) & 0xFF;
Jeonghoon 3:2a3664dc6634 43 *(outbuffer + offset + 3) = (this->data_offset >> (8 * 3)) & 0xFF;
Jeonghoon 3:2a3664dc6634 44 offset += sizeof(this->data_offset);
Jeonghoon 3:2a3664dc6634 45 return offset;
Jeonghoon 3:2a3664dc6634 46 }
Jeonghoon 3:2a3664dc6634 47
Jeonghoon 3:2a3664dc6634 48 virtual int deserialize(unsigned char *inbuffer)
Jeonghoon 3:2a3664dc6634 49 {
Jeonghoon 3:2a3664dc6634 50 int offset = 0;
Jeonghoon 3:2a3664dc6634 51 uint32_t dim_lengthT = ((uint32_t) (*(inbuffer + offset)));
Jeonghoon 3:2a3664dc6634 52 dim_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 3:2a3664dc6634 53 dim_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 3:2a3664dc6634 54 dim_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 3:2a3664dc6634 55 offset += sizeof(this->dim_length);
Jeonghoon 3:2a3664dc6634 56 if(dim_lengthT > dim_length)
Jeonghoon 3:2a3664dc6634 57 this->dim = (std_msgs::MultiArrayDimension*)realloc(this->dim, dim_lengthT * sizeof(std_msgs::MultiArrayDimension));
Jeonghoon 3:2a3664dc6634 58 dim_length = dim_lengthT;
Jeonghoon 3:2a3664dc6634 59 for( uint32_t i = 0; i < dim_length; i++){
Jeonghoon 3:2a3664dc6634 60 offset += this->st_dim.deserialize(inbuffer + offset);
Jeonghoon 3:2a3664dc6634 61 memcpy( &(this->dim[i]), &(this->st_dim), sizeof(std_msgs::MultiArrayDimension));
Jeonghoon 3:2a3664dc6634 62 }
Jeonghoon 3:2a3664dc6634 63 this->data_offset = ((uint32_t) (*(inbuffer + offset)));
Jeonghoon 3:2a3664dc6634 64 this->data_offset |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 3:2a3664dc6634 65 this->data_offset |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 3:2a3664dc6634 66 this->data_offset |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 3:2a3664dc6634 67 offset += sizeof(this->data_offset);
Jeonghoon 3:2a3664dc6634 68 return offset;
Jeonghoon 3:2a3664dc6634 69 }
Jeonghoon 3:2a3664dc6634 70
Jeonghoon 3:2a3664dc6634 71 const char * getType(){ return "std_msgs/MultiArrayLayout"; };
Jeonghoon 3:2a3664dc6634 72 const char * getMD5(){ return "0fed2a11c13e11c5571b4e2a995a91a3"; };
Jeonghoon 3:2a3664dc6634 73
Jeonghoon 3:2a3664dc6634 74 };
Jeonghoon 3:2a3664dc6634 75
Jeonghoon 3:2a3664dc6634 76 }
Jeonghoon 3:2a3664dc6634 77 #endif