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.
Packet.h
00001 #ifndef _ROS_theora_image_transport_Packet_h 00002 #define _ROS_theora_image_transport_Packet_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 theora_image_transport 00011 { 00012 00013 class Packet : public ros::Msg 00014 { 00015 public: 00016 typedef std_msgs::Header _header_type; 00017 _header_type header; 00018 uint32_t data_length; 00019 typedef uint8_t _data_type; 00020 _data_type st_data; 00021 _data_type * data; 00022 typedef int32_t _b_o_s_type; 00023 _b_o_s_type b_o_s; 00024 typedef int32_t _e_o_s_type; 00025 _e_o_s_type e_o_s; 00026 typedef int64_t _granulepos_type; 00027 _granulepos_type granulepos; 00028 typedef int64_t _packetno_type; 00029 _packetno_type packetno; 00030 00031 Packet(): 00032 header(), 00033 data_length(0), data(NULL), 00034 b_o_s(0), 00035 e_o_s(0), 00036 granulepos(0), 00037 packetno(0) 00038 { 00039 } 00040 00041 virtual int serialize(unsigned char *outbuffer) const 00042 { 00043 int offset = 0; 00044 offset += this->header.serialize(outbuffer + offset); 00045 *(outbuffer + offset + 0) = (this->data_length >> (8 * 0)) & 0xFF; 00046 *(outbuffer + offset + 1) = (this->data_length >> (8 * 1)) & 0xFF; 00047 *(outbuffer + offset + 2) = (this->data_length >> (8 * 2)) & 0xFF; 00048 *(outbuffer + offset + 3) = (this->data_length >> (8 * 3)) & 0xFF; 00049 offset += sizeof(this->data_length); 00050 for( uint32_t i = 0; i < data_length; i++){ 00051 *(outbuffer + offset + 0) = (this->data[i] >> (8 * 0)) & 0xFF; 00052 offset += sizeof(this->data[i]); 00053 } 00054 union { 00055 int32_t real; 00056 uint32_t base; 00057 } u_b_o_s; 00058 u_b_o_s.real = this->b_o_s; 00059 *(outbuffer + offset + 0) = (u_b_o_s.base >> (8 * 0)) & 0xFF; 00060 *(outbuffer + offset + 1) = (u_b_o_s.base >> (8 * 1)) & 0xFF; 00061 *(outbuffer + offset + 2) = (u_b_o_s.base >> (8 * 2)) & 0xFF; 00062 *(outbuffer + offset + 3) = (u_b_o_s.base >> (8 * 3)) & 0xFF; 00063 offset += sizeof(this->b_o_s); 00064 union { 00065 int32_t real; 00066 uint32_t base; 00067 } u_e_o_s; 00068 u_e_o_s.real = this->e_o_s; 00069 *(outbuffer + offset + 0) = (u_e_o_s.base >> (8 * 0)) & 0xFF; 00070 *(outbuffer + offset + 1) = (u_e_o_s.base >> (8 * 1)) & 0xFF; 00071 *(outbuffer + offset + 2) = (u_e_o_s.base >> (8 * 2)) & 0xFF; 00072 *(outbuffer + offset + 3) = (u_e_o_s.base >> (8 * 3)) & 0xFF; 00073 offset += sizeof(this->e_o_s); 00074 union { 00075 int64_t real; 00076 uint64_t base; 00077 } u_granulepos; 00078 u_granulepos.real = this->granulepos; 00079 *(outbuffer + offset + 0) = (u_granulepos.base >> (8 * 0)) & 0xFF; 00080 *(outbuffer + offset + 1) = (u_granulepos.base >> (8 * 1)) & 0xFF; 00081 *(outbuffer + offset + 2) = (u_granulepos.base >> (8 * 2)) & 0xFF; 00082 *(outbuffer + offset + 3) = (u_granulepos.base >> (8 * 3)) & 0xFF; 00083 *(outbuffer + offset + 4) = (u_granulepos.base >> (8 * 4)) & 0xFF; 00084 *(outbuffer + offset + 5) = (u_granulepos.base >> (8 * 5)) & 0xFF; 00085 *(outbuffer + offset + 6) = (u_granulepos.base >> (8 * 6)) & 0xFF; 00086 *(outbuffer + offset + 7) = (u_granulepos.base >> (8 * 7)) & 0xFF; 00087 offset += sizeof(this->granulepos); 00088 union { 00089 int64_t real; 00090 uint64_t base; 00091 } u_packetno; 00092 u_packetno.real = this->packetno; 00093 *(outbuffer + offset + 0) = (u_packetno.base >> (8 * 0)) & 0xFF; 00094 *(outbuffer + offset + 1) = (u_packetno.base >> (8 * 1)) & 0xFF; 00095 *(outbuffer + offset + 2) = (u_packetno.base >> (8 * 2)) & 0xFF; 00096 *(outbuffer + offset + 3) = (u_packetno.base >> (8 * 3)) & 0xFF; 00097 *(outbuffer + offset + 4) = (u_packetno.base >> (8 * 4)) & 0xFF; 00098 *(outbuffer + offset + 5) = (u_packetno.base >> (8 * 5)) & 0xFF; 00099 *(outbuffer + offset + 6) = (u_packetno.base >> (8 * 6)) & 0xFF; 00100 *(outbuffer + offset + 7) = (u_packetno.base >> (8 * 7)) & 0xFF; 00101 offset += sizeof(this->packetno); 00102 return offset; 00103 } 00104 00105 virtual int deserialize(unsigned char *inbuffer) 00106 { 00107 int offset = 0; 00108 offset += this->header.deserialize(inbuffer + offset); 00109 uint32_t data_lengthT = ((uint32_t) (*(inbuffer + offset))); 00110 data_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00111 data_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00112 data_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00113 offset += sizeof(this->data_length); 00114 if(data_lengthT > data_length) 00115 this->data = (uint8_t*)realloc(this->data, data_lengthT * sizeof(uint8_t)); 00116 data_length = data_lengthT; 00117 for( uint32_t i = 0; i < data_length; i++){ 00118 this->st_data = ((uint8_t) (*(inbuffer + offset))); 00119 offset += sizeof(this->st_data); 00120 memcpy( &(this->data[i]), &(this->st_data), sizeof(uint8_t)); 00121 } 00122 union { 00123 int32_t real; 00124 uint32_t base; 00125 } u_b_o_s; 00126 u_b_o_s.base = 0; 00127 u_b_o_s.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00128 u_b_o_s.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00129 u_b_o_s.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00130 u_b_o_s.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00131 this->b_o_s = u_b_o_s.real; 00132 offset += sizeof(this->b_o_s); 00133 union { 00134 int32_t real; 00135 uint32_t base; 00136 } u_e_o_s; 00137 u_e_o_s.base = 0; 00138 u_e_o_s.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00139 u_e_o_s.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00140 u_e_o_s.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00141 u_e_o_s.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00142 this->e_o_s = u_e_o_s.real; 00143 offset += sizeof(this->e_o_s); 00144 union { 00145 int64_t real; 00146 uint64_t base; 00147 } u_granulepos; 00148 u_granulepos.base = 0; 00149 u_granulepos.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); 00150 u_granulepos.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); 00151 u_granulepos.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); 00152 u_granulepos.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); 00153 u_granulepos.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); 00154 u_granulepos.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); 00155 u_granulepos.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); 00156 u_granulepos.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); 00157 this->granulepos = u_granulepos.real; 00158 offset += sizeof(this->granulepos); 00159 union { 00160 int64_t real; 00161 uint64_t base; 00162 } u_packetno; 00163 u_packetno.base = 0; 00164 u_packetno.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); 00165 u_packetno.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); 00166 u_packetno.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); 00167 u_packetno.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); 00168 u_packetno.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); 00169 u_packetno.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); 00170 u_packetno.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); 00171 u_packetno.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); 00172 this->packetno = u_packetno.real; 00173 offset += sizeof(this->packetno); 00174 return offset; 00175 } 00176 00177 const char * getType(){ return "theora_image_transport/Packet"; }; 00178 const char * getMD5(){ return "33ac4e14a7cff32e7e0d65f18bb410f3"; }; 00179 00180 }; 00181 00182 } 00183 #endif
Generated on Wed Jul 13 2022 23:30:18 by
