ROS Serial library for Mbed platforms for ROS Indigo Igloo. Check http://wiki.ros.org/rosserial_mbed/ for more information

Dependencies:   BufferedSerial

Dependents:   rosserial_mbed_hello_world_publisher rtos_base_control rosserial_mbed_F64MA ROS-RTOS ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers PointIndices.h Source File

PointIndices.h

00001 #ifndef _ROS_pcl_msgs_PointIndices_h
00002 #define _ROS_pcl_msgs_PointIndices_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 
00010 namespace pcl_msgs
00011 {
00012 
00013   class PointIndices : public ros::Msg
00014   {
00015     public:
00016       std_msgs::Header header;
00017       uint8_t indices_length;
00018       int32_t st_indices;
00019       int32_t * indices;
00020 
00021     PointIndices():
00022       header(),
00023       indices_length(0), indices(NULL)
00024     {
00025     }
00026 
00027     virtual int serialize(unsigned char *outbuffer) const
00028     {
00029       int offset = 0;
00030       offset += this->header.serialize(outbuffer + offset);
00031       *(outbuffer + offset++) = indices_length;
00032       *(outbuffer + offset++) = 0;
00033       *(outbuffer + offset++) = 0;
00034       *(outbuffer + offset++) = 0;
00035       for( uint8_t i = 0; i < indices_length; i++){
00036       union {
00037         int32_t real;
00038         uint32_t base;
00039       } u_indicesi;
00040       u_indicesi.real = this->indices[i];
00041       *(outbuffer + offset + 0) = (u_indicesi.base >> (8 * 0)) & 0xFF;
00042       *(outbuffer + offset + 1) = (u_indicesi.base >> (8 * 1)) & 0xFF;
00043       *(outbuffer + offset + 2) = (u_indicesi.base >> (8 * 2)) & 0xFF;
00044       *(outbuffer + offset + 3) = (u_indicesi.base >> (8 * 3)) & 0xFF;
00045       offset += sizeof(this->indices[i]);
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       uint8_t indices_lengthT = *(inbuffer + offset++);
00055       if(indices_lengthT > indices_length)
00056         this->indices = (int32_t*)realloc(this->indices, indices_lengthT * sizeof(int32_t));
00057       offset += 3;
00058       indices_length = indices_lengthT;
00059       for( uint8_t i = 0; i < indices_length; i++){
00060       union {
00061         int32_t real;
00062         uint32_t base;
00063       } u_st_indices;
00064       u_st_indices.base = 0;
00065       u_st_indices.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00066       u_st_indices.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00067       u_st_indices.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00068       u_st_indices.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00069       this->st_indices = u_st_indices.real;
00070       offset += sizeof(this->st_indices);
00071         memcpy( &(this->indices[i]), &(this->st_indices), sizeof(int32_t));
00072       }
00073      return offset;
00074     }
00075 
00076     const char * getType(){ return "pcl_msgs/PointIndices"; };
00077     const char * getMD5(){ return "458c7998b7eaf99908256472e273b3d4"; };
00078 
00079   };
00080 
00081 }
00082 #endif