catchrobo2022 / Mbed 2 deprecated catchrobo2022_mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Table.h Source File

Table.h

00001 #ifndef _ROS_object_recognition_msgs_Table_h
00002 #define _ROS_object_recognition_msgs_Table_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 "geometry_msgs/Pose.h"
00010 #include "geometry_msgs/Point.h"
00011 
00012 namespace object_recognition_msgs
00013 {
00014 
00015   class Table : public ros::Msg
00016   {
00017     public:
00018       typedef std_msgs::Header _header_type;
00019       _header_type header;
00020       typedef geometry_msgs::Pose _pose_type;
00021       _pose_type pose;
00022       uint32_t convex_hull_length;
00023       typedef geometry_msgs::Point _convex_hull_type;
00024       _convex_hull_type st_convex_hull;
00025       _convex_hull_type * convex_hull;
00026 
00027     Table():
00028       header(),
00029       pose(),
00030       convex_hull_length(0), convex_hull(NULL)
00031     {
00032     }
00033 
00034     virtual int serialize(unsigned char *outbuffer) const
00035     {
00036       int offset = 0;
00037       offset += this->header.serialize(outbuffer + offset);
00038       offset += this->pose.serialize(outbuffer + offset);
00039       *(outbuffer + offset + 0) = (this->convex_hull_length >> (8 * 0)) & 0xFF;
00040       *(outbuffer + offset + 1) = (this->convex_hull_length >> (8 * 1)) & 0xFF;
00041       *(outbuffer + offset + 2) = (this->convex_hull_length >> (8 * 2)) & 0xFF;
00042       *(outbuffer + offset + 3) = (this->convex_hull_length >> (8 * 3)) & 0xFF;
00043       offset += sizeof(this->convex_hull_length);
00044       for( uint32_t i = 0; i < convex_hull_length; i++){
00045       offset += this->convex_hull[i].serialize(outbuffer + offset);
00046       }
00047       return offset;
00048     }
00049 
00050     virtual int deserialize(unsigned char *inbuffer)
00051     {
00052       int offset = 0;
00053       offset += this->header.deserialize(inbuffer + offset);
00054       offset += this->pose.deserialize(inbuffer + offset);
00055       uint32_t convex_hull_lengthT = ((uint32_t) (*(inbuffer + offset))); 
00056       convex_hull_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 
00057       convex_hull_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 
00058       convex_hull_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 
00059       offset += sizeof(this->convex_hull_length);
00060       if(convex_hull_lengthT > convex_hull_length)
00061         this->convex_hull = (geometry_msgs::Point*)realloc(this->convex_hull, convex_hull_lengthT * sizeof(geometry_msgs::Point));
00062       convex_hull_length = convex_hull_lengthT;
00063       for( uint32_t i = 0; i < convex_hull_length; i++){
00064       offset += this->st_convex_hull.deserialize(inbuffer + offset);
00065         memcpy( &(this->convex_hull[i]), &(this->st_convex_hull), sizeof(geometry_msgs::Point));
00066       }
00067      return offset;
00068     }
00069 
00070     virtual const char * getType(){ return "object_recognition_msgs/Table"; };
00071     virtual const char * getMD5(){ return "39efebc7d51e44bd2d72f2df6c7823a2"; };
00072 
00073   };
00074 
00075 }
00076 #endif