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
TopicInfo.h
00001 #ifndef _ROS_jsk_topic_tools_TopicInfo_h 00002 #define _ROS_jsk_topic_tools_TopicInfo_h 00003 00004 #include <stdint.h> 00005 #include <string.h> 00006 #include <stdlib.h> 00007 #include "ros/msg.h" 00008 00009 namespace jsk_topic_tools 00010 { 00011 00012 class TopicInfo : public ros::Msg 00013 { 00014 public: 00015 typedef const char* _topic_name_type; 00016 _topic_name_type topic_name; 00017 typedef double _rate_type; 00018 _rate_type rate; 00019 00020 TopicInfo(): 00021 topic_name(""), 00022 rate(0) 00023 { 00024 } 00025 00026 virtual int serialize(unsigned char *outbuffer) const 00027 { 00028 int offset = 0; 00029 uint32_t length_topic_name = strlen(this->topic_name); 00030 varToArr(outbuffer + offset, length_topic_name); 00031 offset += 4; 00032 memcpy(outbuffer + offset, this->topic_name, length_topic_name); 00033 offset += length_topic_name; 00034 union { 00035 double real; 00036 uint64_t base; 00037 } u_rate; 00038 u_rate.real = this->rate; 00039 *(outbuffer + offset + 0) = (u_rate.base >> (8 * 0)) & 0xFF; 00040 *(outbuffer + offset + 1) = (u_rate.base >> (8 * 1)) & 0xFF; 00041 *(outbuffer + offset + 2) = (u_rate.base >> (8 * 2)) & 0xFF; 00042 *(outbuffer + offset + 3) = (u_rate.base >> (8 * 3)) & 0xFF; 00043 *(outbuffer + offset + 4) = (u_rate.base >> (8 * 4)) & 0xFF; 00044 *(outbuffer + offset + 5) = (u_rate.base >> (8 * 5)) & 0xFF; 00045 *(outbuffer + offset + 6) = (u_rate.base >> (8 * 6)) & 0xFF; 00046 *(outbuffer + offset + 7) = (u_rate.base >> (8 * 7)) & 0xFF; 00047 offset += sizeof(this->rate); 00048 return offset; 00049 } 00050 00051 virtual int deserialize(unsigned char *inbuffer) 00052 { 00053 int offset = 0; 00054 uint32_t length_topic_name; 00055 arrToVar(length_topic_name, (inbuffer + offset)); 00056 offset += 4; 00057 for(unsigned int k= offset; k< offset+length_topic_name; ++k){ 00058 inbuffer[k-1]=inbuffer[k]; 00059 } 00060 inbuffer[offset+length_topic_name-1]=0; 00061 this->topic_name = (char *)(inbuffer + offset-1); 00062 offset += length_topic_name; 00063 union { 00064 double real; 00065 uint64_t base; 00066 } u_rate; 00067 u_rate.base = 0; 00068 u_rate.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); 00069 u_rate.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); 00070 u_rate.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); 00071 u_rate.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); 00072 u_rate.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); 00073 u_rate.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); 00074 u_rate.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); 00075 u_rate.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); 00076 this->rate = u_rate.real; 00077 offset += sizeof(this->rate); 00078 return offset; 00079 } 00080 00081 virtual const char * getType(){ return "jsk_topic_tools/TopicInfo"; }; 00082 virtual const char * getMD5(){ return "78edf14defd72c2fcd29e4fad0165ea9"; }; 00083 00084 }; 00085 00086 } 00087 #endif
Generated on Mon Sep 26 2022 13:47:04 by
