Irfan Tito Kurniawan / ros_lib
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers RoutePath.h Source File

RoutePath.h

00001 #ifndef _ROS_geographic_msgs_RoutePath_h
00002 #define _ROS_geographic_msgs_RoutePath_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 #include "uuid_msgs/UniqueID.h"
00010 #include "geographic_msgs/KeyValue.h"
00011 
00012 namespace geographic_msgs
00013 {
00014 
00015   class RoutePath : public ros::Msg
00016   {
00017     public:
00018       typedef std_msgs::Header _header_type;
00019       _header_type header;
00020       typedef uuid_msgs::UniqueID _network_type;
00021       _network_type network;
00022       uint32_t segments_length;
00023       typedef uuid_msgs::UniqueID _segments_type;
00024       _segments_type st_segments;
00025       _segments_type * segments;
00026       uint32_t props_length;
00027       typedef geographic_msgs::KeyValue _props_type;
00028       _props_type st_props;
00029       _props_type * props;
00030 
00031     RoutePath():
00032       header(),
00033       network(),
00034       segments_length(0), segments(NULL),
00035       props_length(0), props(NULL)
00036     {
00037     }
00038 
00039     virtual int serialize(unsigned char *outbuffer) const
00040     {
00041       int offset = 0;
00042       offset += this->header.serialize(outbuffer + offset);
00043       offset += this->network.serialize(outbuffer + offset);
00044       *(outbuffer + offset + 0) = (this->segments_length >> (8 * 0)) & 0xFF;
00045       *(outbuffer + offset + 1) = (this->segments_length >> (8 * 1)) & 0xFF;
00046       *(outbuffer + offset + 2) = (this->segments_length >> (8 * 2)) & 0xFF;
00047       *(outbuffer + offset + 3) = (this->segments_length >> (8 * 3)) & 0xFF;
00048       offset += sizeof(this->segments_length);
00049       for( uint32_t i = 0; i < segments_length; i++){
00050       offset += this->segments[i].serialize(outbuffer + offset);
00051       }
00052       *(outbuffer + offset + 0) = (this->props_length >> (8 * 0)) & 0xFF;
00053       *(outbuffer + offset + 1) = (this->props_length >> (8 * 1)) & 0xFF;
00054       *(outbuffer + offset + 2) = (this->props_length >> (8 * 2)) & 0xFF;
00055       *(outbuffer + offset + 3) = (this->props_length >> (8 * 3)) & 0xFF;
00056       offset += sizeof(this->props_length);
00057       for( uint32_t i = 0; i < props_length; i++){
00058       offset += this->props[i].serialize(outbuffer + offset);
00059       }
00060       return offset;
00061     }
00062 
00063     virtual int deserialize(unsigned char *inbuffer)
00064     {
00065       int offset = 0;
00066       offset += this->header.deserialize(inbuffer + offset);
00067       offset += this->network.deserialize(inbuffer + offset);
00068       uint32_t segments_lengthT = ((uint32_t) (*(inbuffer + offset))); 
00069       segments_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 
00070       segments_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 
00071       segments_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 
00072       offset += sizeof(this->segments_length);
00073       if(segments_lengthT > segments_length)
00074         this->segments = (uuid_msgs::UniqueID*)realloc(this->segments, segments_lengthT * sizeof(uuid_msgs::UniqueID));
00075       segments_length = segments_lengthT;
00076       for( uint32_t i = 0; i < segments_length; i++){
00077       offset += this->st_segments.deserialize(inbuffer + offset);
00078         memcpy( &(this->segments[i]), &(this->st_segments), sizeof(uuid_msgs::UniqueID));
00079       }
00080       uint32_t props_lengthT = ((uint32_t) (*(inbuffer + offset))); 
00081       props_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 
00082       props_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 
00083       props_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 
00084       offset += sizeof(this->props_length);
00085       if(props_lengthT > props_length)
00086         this->props = (geographic_msgs::KeyValue*)realloc(this->props, props_lengthT * sizeof(geographic_msgs::KeyValue));
00087       props_length = props_lengthT;
00088       for( uint32_t i = 0; i < props_length; i++){
00089       offset += this->st_props.deserialize(inbuffer + offset);
00090         memcpy( &(this->props[i]), &(this->st_props), sizeof(geographic_msgs::KeyValue));
00091       }
00092      return offset;
00093     }
00094 
00095     const char * getType(){ return "geographic_msgs/RoutePath"; };
00096     const char * getMD5(){ return "0aa2dd809a8091bdb4466dfefecbb8cf"; };
00097 
00098   };
00099 
00100 }
00101 #endif