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.
Dependencies: mbed
VectorArray.h
00001 #ifndef _ROS_jsk_recognition_msgs_VectorArray_h 00002 #define _ROS_jsk_recognition_msgs_VectorArray_h 00003 00004 #include <stdint.h> 00005 #include <string.h> 00006 #include <stdlib.h> 00007 #include "ros/msg.h" 00008 #include "std_msgs/Header.h" 00009 00010 namespace jsk_recognition_msgs 00011 { 00012 00013 class VectorArray : public ros::Msg 00014 { 00015 public: 00016 typedef std_msgs::Header _header_type; 00017 _header_type header; 00018 typedef int32_t _vector_dim_type; 00019 _vector_dim_type vector_dim; 00020 uint32_t data_length; 00021 typedef double _data_type; 00022 _data_type st_data; 00023 _data_type * data; 00024 00025 VectorArray(): 00026 header(), 00027 vector_dim(0), 00028 data_length(0), data(NULL) 00029 { 00030 } 00031 00032 virtual int serialize(unsigned char *outbuffer) const 00033 { 00034 int offset = 0; 00035 offset += this->header.serialize(outbuffer + offset); 00036 union { 00037 int32_t real; 00038 uint32_t base; 00039 } u_vector_dim; 00040 u_vector_dim.real = this->vector_dim; 00041 *(outbuffer + offset + 0) = (u_vector_dim.base >> (8 * 0)) & 0xFF; 00042 *(outbuffer + offset + 1) = (u_vector_dim.base >> (8 * 1)) & 0xFF; 00043 *(outbuffer + offset + 2) = (u_vector_dim.base >> (8 * 2)) & 0xFF; 00044 *(outbuffer + offset + 3) = (u_vector_dim.base >> (8 * 3)) & 0xFF; 00045 offset += sizeof(this->vector_dim); 00046 *(outbuffer + offset + 0) = (this->data_length >> (8 * 0)) & 0xFF; 00047 *(outbuffer + offset + 1) = (this->data_length >> (8 * 1)) & 0xFF; 00048 *(outbuffer + offset + 2) = (this->data_length >> (8 * 2)) & 0xFF; 00049 *(outbuffer + offset + 3) = (this->data_length >> (8 * 3)) & 0xFF; 00050 offset += sizeof(this->data_length); 00051 for( uint32_t i = 0; i < data_length; i++){ 00052 union { 00053 double real; 00054 uint64_t base; 00055 } u_datai; 00056 u_datai.real = this->data[i]; 00057 *(outbuffer + offset + 0) = (u_datai.base >> (8 * 0)) & 0xFF; 00058 *(outbuffer + offset + 1) = (u_datai.base >> (8 * 1)) & 0xFF; 00059 *(outbuffer + offset + 2) = (u_datai.base >> (8 * 2)) & 0xFF; 00060 *(outbuffer + offset + 3) = (u_datai.base >> (8 * 3)) & 0xFF; 00061 *(outbuffer + offset + 4) = (u_datai.base >> (8 * 4)) & 0xFF; 00062 *(outbuffer + offset + 5) = (u_datai.base >> (8 * 5)) & 0xFF; 00063 *(outbuffer + offset + 6) = (u_datai.base >> (8 * 6)) & 0xFF; 00064 *(outbuffer + offset + 7) = (u_datai.base >> (8 * 7)) & 0xFF; 00065 offset += sizeof(this->data[i]); 00066 } 00067 return offset; 00068 } 00069 00070 virtual int deserialize(unsigned char *inbuffer) 00071 { 00072 int offset = 0; 00073 offset += this->header.deserialize(inbuffer + offset); 00074 union { 00075 int32_t real; 00076 uint32_t base; 00077 } u_vector_dim; 00078 u_vector_dim.base = 0; 00079 u_vector_dim.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00080 u_vector_dim.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00081 u_vector_dim.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00082 u_vector_dim.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00083 this->vector_dim = u_vector_dim.real; 00084 offset += sizeof(this->vector_dim); 00085 uint32_t data_lengthT = ((uint32_t) (*(inbuffer + offset))); 00086 data_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00087 data_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00088 data_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00089 offset += sizeof(this->data_length); 00090 if(data_lengthT > data_length) 00091 this->data = (double*)realloc(this->data, data_lengthT * sizeof(double)); 00092 data_length = data_lengthT; 00093 for( uint32_t i = 0; i < data_length; i++){ 00094 union { 00095 double real; 00096 uint64_t base; 00097 } u_st_data; 00098 u_st_data.base = 0; 00099 u_st_data.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); 00100 u_st_data.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); 00101 u_st_data.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); 00102 u_st_data.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); 00103 u_st_data.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); 00104 u_st_data.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); 00105 u_st_data.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); 00106 u_st_data.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); 00107 this->st_data = u_st_data.real; 00108 offset += sizeof(this->st_data); 00109 memcpy( &(this->data[i]), &(this->st_data), sizeof(double)); 00110 } 00111 return offset; 00112 } 00113 00114 virtual const char * getType(){ return "jsk_recognition_msgs/VectorArray"; }; 00115 virtual const char * getMD5(){ return "5755776409eb8318e94c95cd52de2b69"; }; 00116 00117 }; 00118 00119 } 00120 #endif
Generated on Mon Sep 26 2022 13:47:04 by
