Working towards recieving twists
Fork of ros_lib_kinetic by
Embed:
(wiki syntax)
Show/hide line numbers
Status.h
00001 #ifndef _ROS_bond_Status_h 00002 #define _ROS_bond_Status_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 bond 00011 { 00012 00013 class Status : public ros::Msg 00014 { 00015 public: 00016 typedef std_msgs::Header _header_type; 00017 _header_type header; 00018 typedef const char* _id_type; 00019 _id_type id; 00020 typedef const char* _instance_id_type; 00021 _instance_id_type instance_id; 00022 typedef bool _active_type; 00023 _active_type active; 00024 typedef float _heartbeat_timeout_type; 00025 _heartbeat_timeout_type heartbeat_timeout; 00026 typedef float _heartbeat_period_type; 00027 _heartbeat_period_type heartbeat_period; 00028 00029 Status(): 00030 header(), 00031 id(""), 00032 instance_id(""), 00033 active(0), 00034 heartbeat_timeout(0), 00035 heartbeat_period(0) 00036 { 00037 } 00038 00039 virtual int serialize(unsigned char *outbuffer) const 00040 { 00041 int offset = 0; 00042 offset += this->header.serialize(outbuffer + offset); 00043 uint32_t length_id = strlen(this->id); 00044 varToArr(outbuffer + offset, length_id); 00045 offset += 4; 00046 memcpy(outbuffer + offset, this->id, length_id); 00047 offset += length_id; 00048 uint32_t length_instance_id = strlen(this->instance_id); 00049 varToArr(outbuffer + offset, length_instance_id); 00050 offset += 4; 00051 memcpy(outbuffer + offset, this->instance_id, length_instance_id); 00052 offset += length_instance_id; 00053 union { 00054 bool real; 00055 uint8_t base; 00056 } u_active; 00057 u_active.real = this->active; 00058 *(outbuffer + offset + 0) = (u_active.base >> (8 * 0)) & 0xFF; 00059 offset += sizeof(this->active); 00060 union { 00061 float real; 00062 uint32_t base; 00063 } u_heartbeat_timeout; 00064 u_heartbeat_timeout.real = this->heartbeat_timeout; 00065 *(outbuffer + offset + 0) = (u_heartbeat_timeout.base >> (8 * 0)) & 0xFF; 00066 *(outbuffer + offset + 1) = (u_heartbeat_timeout.base >> (8 * 1)) & 0xFF; 00067 *(outbuffer + offset + 2) = (u_heartbeat_timeout.base >> (8 * 2)) & 0xFF; 00068 *(outbuffer + offset + 3) = (u_heartbeat_timeout.base >> (8 * 3)) & 0xFF; 00069 offset += sizeof(this->heartbeat_timeout); 00070 union { 00071 float real; 00072 uint32_t base; 00073 } u_heartbeat_period; 00074 u_heartbeat_period.real = this->heartbeat_period; 00075 *(outbuffer + offset + 0) = (u_heartbeat_period.base >> (8 * 0)) & 0xFF; 00076 *(outbuffer + offset + 1) = (u_heartbeat_period.base >> (8 * 1)) & 0xFF; 00077 *(outbuffer + offset + 2) = (u_heartbeat_period.base >> (8 * 2)) & 0xFF; 00078 *(outbuffer + offset + 3) = (u_heartbeat_period.base >> (8 * 3)) & 0xFF; 00079 offset += sizeof(this->heartbeat_period); 00080 return offset; 00081 } 00082 00083 virtual int deserialize(unsigned char *inbuffer) 00084 { 00085 int offset = 0; 00086 offset += this->header.deserialize(inbuffer + offset); 00087 uint32_t length_id; 00088 arrToVar(length_id, (inbuffer + offset)); 00089 offset += 4; 00090 for(unsigned int k= offset; k< offset+length_id; ++k){ 00091 inbuffer[k-1]=inbuffer[k]; 00092 } 00093 inbuffer[offset+length_id-1]=0; 00094 this->id = (char *)(inbuffer + offset-1); 00095 offset += length_id; 00096 uint32_t length_instance_id; 00097 arrToVar(length_instance_id, (inbuffer + offset)); 00098 offset += 4; 00099 for(unsigned int k= offset; k< offset+length_instance_id; ++k){ 00100 inbuffer[k-1]=inbuffer[k]; 00101 } 00102 inbuffer[offset+length_instance_id-1]=0; 00103 this->instance_id = (char *)(inbuffer + offset-1); 00104 offset += length_instance_id; 00105 union { 00106 bool real; 00107 uint8_t base; 00108 } u_active; 00109 u_active.base = 0; 00110 u_active.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); 00111 this->active = u_active.real; 00112 offset += sizeof(this->active); 00113 union { 00114 float real; 00115 uint32_t base; 00116 } u_heartbeat_timeout; 00117 u_heartbeat_timeout.base = 0; 00118 u_heartbeat_timeout.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00119 u_heartbeat_timeout.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00120 u_heartbeat_timeout.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00121 u_heartbeat_timeout.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00122 this->heartbeat_timeout = u_heartbeat_timeout.real; 00123 offset += sizeof(this->heartbeat_timeout); 00124 union { 00125 float real; 00126 uint32_t base; 00127 } u_heartbeat_period; 00128 u_heartbeat_period.base = 0; 00129 u_heartbeat_period.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00130 u_heartbeat_period.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00131 u_heartbeat_period.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00132 u_heartbeat_period.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00133 this->heartbeat_period = u_heartbeat_period.real; 00134 offset += sizeof(this->heartbeat_period); 00135 return offset; 00136 } 00137 00138 const char * getType(){ return "bond/Status"; }; 00139 const char * getMD5(){ return "eacc84bf5d65b6777d4c50f463dfb9c8"; }; 00140 00141 }; 00142 00143 } 00144 #endif
Generated on Tue Jul 12 2022 21:32:17 by 1.7.2