Irfan Tito Kurniawan / ros_lib
Committer:
irfantitok
Date:
Wed Sep 02 13:51:31 2020 +0000
Revision:
0:8f3710bfd298
Resolved round not found

Who changed what in which revision?

UserRevisionLine numberNew contents of line
irfantitok 0:8f3710bfd298 1 #ifndef _ROS_geographic_msgs_MapFeature_h
irfantitok 0:8f3710bfd298 2 #define _ROS_geographic_msgs_MapFeature_h
irfantitok 0:8f3710bfd298 3
irfantitok 0:8f3710bfd298 4 #include <stdint.h>
irfantitok 0:8f3710bfd298 5 #include <string.h>
irfantitok 0:8f3710bfd298 6 #include <stdlib.h>
irfantitok 0:8f3710bfd298 7 #include "ros/msg.h"
irfantitok 0:8f3710bfd298 8 #include "uuid_msgs/UniqueID.h"
irfantitok 0:8f3710bfd298 9 #include "geographic_msgs/KeyValue.h"
irfantitok 0:8f3710bfd298 10
irfantitok 0:8f3710bfd298 11 namespace geographic_msgs
irfantitok 0:8f3710bfd298 12 {
irfantitok 0:8f3710bfd298 13
irfantitok 0:8f3710bfd298 14 class MapFeature : public ros::Msg
irfantitok 0:8f3710bfd298 15 {
irfantitok 0:8f3710bfd298 16 public:
irfantitok 0:8f3710bfd298 17 typedef uuid_msgs::UniqueID _id_type;
irfantitok 0:8f3710bfd298 18 _id_type id;
irfantitok 0:8f3710bfd298 19 uint32_t components_length;
irfantitok 0:8f3710bfd298 20 typedef uuid_msgs::UniqueID _components_type;
irfantitok 0:8f3710bfd298 21 _components_type st_components;
irfantitok 0:8f3710bfd298 22 _components_type * components;
irfantitok 0:8f3710bfd298 23 uint32_t props_length;
irfantitok 0:8f3710bfd298 24 typedef geographic_msgs::KeyValue _props_type;
irfantitok 0:8f3710bfd298 25 _props_type st_props;
irfantitok 0:8f3710bfd298 26 _props_type * props;
irfantitok 0:8f3710bfd298 27
irfantitok 0:8f3710bfd298 28 MapFeature():
irfantitok 0:8f3710bfd298 29 id(),
irfantitok 0:8f3710bfd298 30 components_length(0), components(NULL),
irfantitok 0:8f3710bfd298 31 props_length(0), props(NULL)
irfantitok 0:8f3710bfd298 32 {
irfantitok 0:8f3710bfd298 33 }
irfantitok 0:8f3710bfd298 34
irfantitok 0:8f3710bfd298 35 virtual int serialize(unsigned char *outbuffer) const
irfantitok 0:8f3710bfd298 36 {
irfantitok 0:8f3710bfd298 37 int offset = 0;
irfantitok 0:8f3710bfd298 38 offset += this->id.serialize(outbuffer + offset);
irfantitok 0:8f3710bfd298 39 *(outbuffer + offset + 0) = (this->components_length >> (8 * 0)) & 0xFF;
irfantitok 0:8f3710bfd298 40 *(outbuffer + offset + 1) = (this->components_length >> (8 * 1)) & 0xFF;
irfantitok 0:8f3710bfd298 41 *(outbuffer + offset + 2) = (this->components_length >> (8 * 2)) & 0xFF;
irfantitok 0:8f3710bfd298 42 *(outbuffer + offset + 3) = (this->components_length >> (8 * 3)) & 0xFF;
irfantitok 0:8f3710bfd298 43 offset += sizeof(this->components_length);
irfantitok 0:8f3710bfd298 44 for( uint32_t i = 0; i < components_length; i++){
irfantitok 0:8f3710bfd298 45 offset += this->components[i].serialize(outbuffer + offset);
irfantitok 0:8f3710bfd298 46 }
irfantitok 0:8f3710bfd298 47 *(outbuffer + offset + 0) = (this->props_length >> (8 * 0)) & 0xFF;
irfantitok 0:8f3710bfd298 48 *(outbuffer + offset + 1) = (this->props_length >> (8 * 1)) & 0xFF;
irfantitok 0:8f3710bfd298 49 *(outbuffer + offset + 2) = (this->props_length >> (8 * 2)) & 0xFF;
irfantitok 0:8f3710bfd298 50 *(outbuffer + offset + 3) = (this->props_length >> (8 * 3)) & 0xFF;
irfantitok 0:8f3710bfd298 51 offset += sizeof(this->props_length);
irfantitok 0:8f3710bfd298 52 for( uint32_t i = 0; i < props_length; i++){
irfantitok 0:8f3710bfd298 53 offset += this->props[i].serialize(outbuffer + offset);
irfantitok 0:8f3710bfd298 54 }
irfantitok 0:8f3710bfd298 55 return offset;
irfantitok 0:8f3710bfd298 56 }
irfantitok 0:8f3710bfd298 57
irfantitok 0:8f3710bfd298 58 virtual int deserialize(unsigned char *inbuffer)
irfantitok 0:8f3710bfd298 59 {
irfantitok 0:8f3710bfd298 60 int offset = 0;
irfantitok 0:8f3710bfd298 61 offset += this->id.deserialize(inbuffer + offset);
irfantitok 0:8f3710bfd298 62 uint32_t components_lengthT = ((uint32_t) (*(inbuffer + offset)));
irfantitok 0:8f3710bfd298 63 components_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
irfantitok 0:8f3710bfd298 64 components_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
irfantitok 0:8f3710bfd298 65 components_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
irfantitok 0:8f3710bfd298 66 offset += sizeof(this->components_length);
irfantitok 0:8f3710bfd298 67 if(components_lengthT > components_length)
irfantitok 0:8f3710bfd298 68 this->components = (uuid_msgs::UniqueID*)realloc(this->components, components_lengthT * sizeof(uuid_msgs::UniqueID));
irfantitok 0:8f3710bfd298 69 components_length = components_lengthT;
irfantitok 0:8f3710bfd298 70 for( uint32_t i = 0; i < components_length; i++){
irfantitok 0:8f3710bfd298 71 offset += this->st_components.deserialize(inbuffer + offset);
irfantitok 0:8f3710bfd298 72 memcpy( &(this->components[i]), &(this->st_components), sizeof(uuid_msgs::UniqueID));
irfantitok 0:8f3710bfd298 73 }
irfantitok 0:8f3710bfd298 74 uint32_t props_lengthT = ((uint32_t) (*(inbuffer + offset)));
irfantitok 0:8f3710bfd298 75 props_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
irfantitok 0:8f3710bfd298 76 props_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
irfantitok 0:8f3710bfd298 77 props_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
irfantitok 0:8f3710bfd298 78 offset += sizeof(this->props_length);
irfantitok 0:8f3710bfd298 79 if(props_lengthT > props_length)
irfantitok 0:8f3710bfd298 80 this->props = (geographic_msgs::KeyValue*)realloc(this->props, props_lengthT * sizeof(geographic_msgs::KeyValue));
irfantitok 0:8f3710bfd298 81 props_length = props_lengthT;
irfantitok 0:8f3710bfd298 82 for( uint32_t i = 0; i < props_length; i++){
irfantitok 0:8f3710bfd298 83 offset += this->st_props.deserialize(inbuffer + offset);
irfantitok 0:8f3710bfd298 84 memcpy( &(this->props[i]), &(this->st_props), sizeof(geographic_msgs::KeyValue));
irfantitok 0:8f3710bfd298 85 }
irfantitok 0:8f3710bfd298 86 return offset;
irfantitok 0:8f3710bfd298 87 }
irfantitok 0:8f3710bfd298 88
irfantitok 0:8f3710bfd298 89 const char * getType(){ return "geographic_msgs/MapFeature"; };
irfantitok 0:8f3710bfd298 90 const char * getMD5(){ return "e2505ace5e8da8a15b610eaf62bdefae"; };
irfantitok 0:8f3710bfd298 91
irfantitok 0:8f3710bfd298 92 };
irfantitok 0:8f3710bfd298 93
irfantitok 0:8f3710bfd298 94 }
irfantitok 0:8f3710bfd298 95 #endif