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