catchrobo2022 / Mbed 2 deprecated catchrobo2022_mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ParallelEdge.h Source File

ParallelEdge.h

00001 #ifndef _ROS_jsk_recognition_msgs_ParallelEdge_h
00002 #define _ROS_jsk_recognition_msgs_ParallelEdge_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 "pcl_msgs/PointIndices.h"
00010 #include "pcl_msgs/ModelCoefficients.h"
00011 
00012 namespace jsk_recognition_msgs
00013 {
00014 
00015   class ParallelEdge : public ros::Msg
00016   {
00017     public:
00018       typedef std_msgs::Header _header_type;
00019       _header_type header;
00020       uint32_t cluster_indices_length;
00021       typedef pcl_msgs::PointIndices _cluster_indices_type;
00022       _cluster_indices_type st_cluster_indices;
00023       _cluster_indices_type * cluster_indices;
00024       uint32_t coefficients_length;
00025       typedef pcl_msgs::ModelCoefficients _coefficients_type;
00026       _coefficients_type st_coefficients;
00027       _coefficients_type * coefficients;
00028 
00029     ParallelEdge():
00030       header(),
00031       cluster_indices_length(0), cluster_indices(NULL),
00032       coefficients_length(0), coefficients(NULL)
00033     {
00034     }
00035 
00036     virtual int serialize(unsigned char *outbuffer) const
00037     {
00038       int offset = 0;
00039       offset += this->header.serialize(outbuffer + offset);
00040       *(outbuffer + offset + 0) = (this->cluster_indices_length >> (8 * 0)) & 0xFF;
00041       *(outbuffer + offset + 1) = (this->cluster_indices_length >> (8 * 1)) & 0xFF;
00042       *(outbuffer + offset + 2) = (this->cluster_indices_length >> (8 * 2)) & 0xFF;
00043       *(outbuffer + offset + 3) = (this->cluster_indices_length >> (8 * 3)) & 0xFF;
00044       offset += sizeof(this->cluster_indices_length);
00045       for( uint32_t i = 0; i < cluster_indices_length; i++){
00046       offset += this->cluster_indices[i].serialize(outbuffer + offset);
00047       }
00048       *(outbuffer + offset + 0) = (this->coefficients_length >> (8 * 0)) & 0xFF;
00049       *(outbuffer + offset + 1) = (this->coefficients_length >> (8 * 1)) & 0xFF;
00050       *(outbuffer + offset + 2) = (this->coefficients_length >> (8 * 2)) & 0xFF;
00051       *(outbuffer + offset + 3) = (this->coefficients_length >> (8 * 3)) & 0xFF;
00052       offset += sizeof(this->coefficients_length);
00053       for( uint32_t i = 0; i < coefficients_length; i++){
00054       offset += this->coefficients[i].serialize(outbuffer + offset);
00055       }
00056       return offset;
00057     }
00058 
00059     virtual int deserialize(unsigned char *inbuffer)
00060     {
00061       int offset = 0;
00062       offset += this->header.deserialize(inbuffer + offset);
00063       uint32_t cluster_indices_lengthT = ((uint32_t) (*(inbuffer + offset))); 
00064       cluster_indices_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 
00065       cluster_indices_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 
00066       cluster_indices_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 
00067       offset += sizeof(this->cluster_indices_length);
00068       if(cluster_indices_lengthT > cluster_indices_length)
00069         this->cluster_indices = (pcl_msgs::PointIndices*)realloc(this->cluster_indices, cluster_indices_lengthT * sizeof(pcl_msgs::PointIndices));
00070       cluster_indices_length = cluster_indices_lengthT;
00071       for( uint32_t i = 0; i < cluster_indices_length; i++){
00072       offset += this->st_cluster_indices.deserialize(inbuffer + offset);
00073         memcpy( &(this->cluster_indices[i]), &(this->st_cluster_indices), sizeof(pcl_msgs::PointIndices));
00074       }
00075       uint32_t coefficients_lengthT = ((uint32_t) (*(inbuffer + offset))); 
00076       coefficients_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 
00077       coefficients_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 
00078       coefficients_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 
00079       offset += sizeof(this->coefficients_length);
00080       if(coefficients_lengthT > coefficients_length)
00081         this->coefficients = (pcl_msgs::ModelCoefficients*)realloc(this->coefficients, coefficients_lengthT * sizeof(pcl_msgs::ModelCoefficients));
00082       coefficients_length = coefficients_lengthT;
00083       for( uint32_t i = 0; i < coefficients_length; i++){
00084       offset += this->st_coefficients.deserialize(inbuffer + offset);
00085         memcpy( &(this->coefficients[i]), &(this->st_coefficients), sizeof(pcl_msgs::ModelCoefficients));
00086       }
00087      return offset;
00088     }
00089 
00090     virtual const char * getType(){ return "jsk_recognition_msgs/ParallelEdge"; };
00091     virtual const char * getMD5(){ return "3a550d5b6275fe0a1580ebf8a62dd336"; };
00092 
00093   };
00094 
00095 }
00096 #endif