ros melodic library with custom message
Dependents: Robot_team1_QEI_Douglas Robot_team1
Diff: ros_lib/pcl_msgs/Vertices.h
- Revision:
- 0:020db18a476d
diff -r 000000000000 -r 020db18a476d ros_lib/pcl_msgs/Vertices.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ros_lib/pcl_msgs/Vertices.h Wed Oct 30 14:59:49 2019 +0000 @@ -0,0 +1,71 @@ +#ifndef _ROS_pcl_msgs_Vertices_h +#define _ROS_pcl_msgs_Vertices_h + +#include <stdint.h> +#include <string.h> +#include <stdlib.h> +#include "ros/msg.h" + +namespace pcl_msgs +{ + + class Vertices : public ros::Msg + { + public: + uint32_t vertices_length; + typedef uint32_t _vertices_type; + _vertices_type st_vertices; + _vertices_type * vertices; + + Vertices(): + vertices_length(0), vertices(NULL) + { + } + + virtual int serialize(unsigned char *outbuffer) const + { + int offset = 0; + *(outbuffer + offset + 0) = (this->vertices_length >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (this->vertices_length >> (8 * 1)) & 0xFF; + *(outbuffer + offset + 2) = (this->vertices_length >> (8 * 2)) & 0xFF; + *(outbuffer + offset + 3) = (this->vertices_length >> (8 * 3)) & 0xFF; + offset += sizeof(this->vertices_length); + for( uint32_t i = 0; i < vertices_length; i++){ + *(outbuffer + offset + 0) = (this->vertices[i] >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (this->vertices[i] >> (8 * 1)) & 0xFF; + *(outbuffer + offset + 2) = (this->vertices[i] >> (8 * 2)) & 0xFF; + *(outbuffer + offset + 3) = (this->vertices[i] >> (8 * 3)) & 0xFF; + offset += sizeof(this->vertices[i]); + } + return offset; + } + + virtual int deserialize(unsigned char *inbuffer) + { + int offset = 0; + uint32_t vertices_lengthT = ((uint32_t) (*(inbuffer + offset))); + vertices_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); + vertices_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); + vertices_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); + offset += sizeof(this->vertices_length); + if(vertices_lengthT > vertices_length) + this->vertices = (uint32_t*)realloc(this->vertices, vertices_lengthT * sizeof(uint32_t)); + vertices_length = vertices_lengthT; + for( uint32_t i = 0; i < vertices_length; i++){ + this->st_vertices = ((uint32_t) (*(inbuffer + offset))); + this->st_vertices |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); + this->st_vertices |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); + this->st_vertices |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); + offset += sizeof(this->st_vertices); + memcpy( &(this->vertices[i]), &(this->st_vertices), sizeof(uint32_t)); + } + return offset; + } + + const char * getType(){ return "pcl_msgs/Vertices"; }; + const char * getMD5(){ return "39bd7b1c23763ddd1b882b97cb7cfe11"; }; + + }; + +} +#endif