catchrobo2022 / Mbed 2 deprecated catchrobo2022_mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers HumanSkeletonArray.h Source File

HumanSkeletonArray.h

00001 #ifndef _ROS_jsk_recognition_msgs_HumanSkeletonArray_h
00002 #define _ROS_jsk_recognition_msgs_HumanSkeletonArray_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 "std_msgs/Int32.h"
00010 #include "jsk_recognition_msgs/HumanSkeleton.h"
00011 
00012 namespace jsk_recognition_msgs
00013 {
00014 
00015   class HumanSkeletonArray : public ros::Msg
00016   {
00017     public:
00018       typedef std_msgs::Header _header_type;
00019       _header_type header;
00020       uint32_t human_ids_length;
00021       typedef std_msgs::Int32 _human_ids_type;
00022       _human_ids_type st_human_ids;
00023       _human_ids_type * human_ids;
00024       uint32_t skeletons_length;
00025       typedef jsk_recognition_msgs::HumanSkeleton _skeletons_type;
00026       _skeletons_type st_skeletons;
00027       _skeletons_type * skeletons;
00028 
00029     HumanSkeletonArray():
00030       header(),
00031       human_ids_length(0), human_ids(NULL),
00032       skeletons_length(0), skeletons(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->human_ids_length >> (8 * 0)) & 0xFF;
00041       *(outbuffer + offset + 1) = (this->human_ids_length >> (8 * 1)) & 0xFF;
00042       *(outbuffer + offset + 2) = (this->human_ids_length >> (8 * 2)) & 0xFF;
00043       *(outbuffer + offset + 3) = (this->human_ids_length >> (8 * 3)) & 0xFF;
00044       offset += sizeof(this->human_ids_length);
00045       for( uint32_t i = 0; i < human_ids_length; i++){
00046       offset += this->human_ids[i].serialize(outbuffer + offset);
00047       }
00048       *(outbuffer + offset + 0) = (this->skeletons_length >> (8 * 0)) & 0xFF;
00049       *(outbuffer + offset + 1) = (this->skeletons_length >> (8 * 1)) & 0xFF;
00050       *(outbuffer + offset + 2) = (this->skeletons_length >> (8 * 2)) & 0xFF;
00051       *(outbuffer + offset + 3) = (this->skeletons_length >> (8 * 3)) & 0xFF;
00052       offset += sizeof(this->skeletons_length);
00053       for( uint32_t i = 0; i < skeletons_length; i++){
00054       offset += this->skeletons[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 human_ids_lengthT = ((uint32_t) (*(inbuffer + offset))); 
00064       human_ids_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 
00065       human_ids_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 
00066       human_ids_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 
00067       offset += sizeof(this->human_ids_length);
00068       if(human_ids_lengthT > human_ids_length)
00069         this->human_ids = (std_msgs::Int32*)realloc(this->human_ids, human_ids_lengthT * sizeof(std_msgs::Int32));
00070       human_ids_length = human_ids_lengthT;
00071       for( uint32_t i = 0; i < human_ids_length; i++){
00072       offset += this->st_human_ids.deserialize(inbuffer + offset);
00073         memcpy( &(this->human_ids[i]), &(this->st_human_ids), sizeof(std_msgs::Int32));
00074       }
00075       uint32_t skeletons_lengthT = ((uint32_t) (*(inbuffer + offset))); 
00076       skeletons_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 
00077       skeletons_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 
00078       skeletons_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 
00079       offset += sizeof(this->skeletons_length);
00080       if(skeletons_lengthT > skeletons_length)
00081         this->skeletons = (jsk_recognition_msgs::HumanSkeleton*)realloc(this->skeletons, skeletons_lengthT * sizeof(jsk_recognition_msgs::HumanSkeleton));
00082       skeletons_length = skeletons_lengthT;
00083       for( uint32_t i = 0; i < skeletons_length; i++){
00084       offset += this->st_skeletons.deserialize(inbuffer + offset);
00085         memcpy( &(this->skeletons[i]), &(this->st_skeletons), sizeof(jsk_recognition_msgs::HumanSkeleton));
00086       }
00087      return offset;
00088     }
00089 
00090     virtual const char * getType(){ return "jsk_recognition_msgs/HumanSkeletonArray"; };
00091     virtual const char * getMD5(){ return "4013ce44abe9aafa9055e095797a9d50"; };
00092 
00093   };
00094 
00095 }
00096 #endif