RecognizedObjectArray.h
Go to the documentation of this file.
00001 #ifndef _ROS_object_recognition_msgs_RecognizedObjectArray_h
00002 #define _ROS_object_recognition_msgs_RecognizedObjectArray_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 "object_recognition_msgs/RecognizedObject.h"
00010 
00011 namespace object_recognition_msgs
00012 {
00013 
00014   class RecognizedObjectArray : public ros::Msg
00015   {
00016     public:
00017       std_msgs::Header header;
00018       uint8_t objects_length;
00019       object_recognition_msgs::RecognizedObject st_objects;
00020       object_recognition_msgs::RecognizedObject * objects;
00021       uint8_t cooccurrence_length;
00022       float st_cooccurrence;
00023       float * cooccurrence;
00024 
00025     virtual int serialize(unsigned char *outbuffer) const
00026     {
00027       int offset = 0;
00028       offset += this->header.serialize(outbuffer + offset);
00029       *(outbuffer + offset++) = objects_length;
00030       *(outbuffer + offset++) = 0;
00031       *(outbuffer + offset++) = 0;
00032       *(outbuffer + offset++) = 0;
00033       for( uint8_t i = 0; i < objects_length; i++){
00034       offset += this->objects[i].serialize(outbuffer + offset);
00035       }
00036       *(outbuffer + offset++) = cooccurrence_length;
00037       *(outbuffer + offset++) = 0;
00038       *(outbuffer + offset++) = 0;
00039       *(outbuffer + offset++) = 0;
00040       for( uint8_t i = 0; i < cooccurrence_length; i++){
00041       union {
00042         float real;
00043         uint32_t base;
00044       } u_cooccurrencei;
00045       u_cooccurrencei.real = this->cooccurrence[i];
00046       *(outbuffer + offset + 0) = (u_cooccurrencei.base >> (8 * 0)) & 0xFF;
00047       *(outbuffer + offset + 1) = (u_cooccurrencei.base >> (8 * 1)) & 0xFF;
00048       *(outbuffer + offset + 2) = (u_cooccurrencei.base >> (8 * 2)) & 0xFF;
00049       *(outbuffer + offset + 3) = (u_cooccurrencei.base >> (8 * 3)) & 0xFF;
00050       offset += sizeof(this->cooccurrence[i]);
00051       }
00052       return offset;
00053     }
00054 
00055     virtual int deserialize(unsigned char *inbuffer)
00056     {
00057       int offset = 0;
00058       offset += this->header.deserialize(inbuffer + offset);
00059       uint8_t objects_lengthT = *(inbuffer + offset++);
00060       if(objects_lengthT > objects_length)
00061         this->objects = (object_recognition_msgs::RecognizedObject*)realloc(this->objects, objects_lengthT * sizeof(object_recognition_msgs::RecognizedObject));
00062       offset += 3;
00063       objects_length = objects_lengthT;
00064       for( uint8_t i = 0; i < objects_length; i++){
00065       offset += this->st_objects.deserialize(inbuffer + offset);
00066         memcpy( &(this->objects[i]), &(this->st_objects), sizeof(object_recognition_msgs::RecognizedObject));
00067       }
00068       uint8_t cooccurrence_lengthT = *(inbuffer + offset++);
00069       if(cooccurrence_lengthT > cooccurrence_length)
00070         this->cooccurrence = (float*)realloc(this->cooccurrence, cooccurrence_lengthT * sizeof(float));
00071       offset += 3;
00072       cooccurrence_length = cooccurrence_lengthT;
00073       for( uint8_t i = 0; i < cooccurrence_length; i++){
00074       union {
00075         float real;
00076         uint32_t base;
00077       } u_st_cooccurrence;
00078       u_st_cooccurrence.base = 0;
00079       u_st_cooccurrence.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00080       u_st_cooccurrence.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00081       u_st_cooccurrence.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00082       u_st_cooccurrence.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00083       this->st_cooccurrence = u_st_cooccurrence.real;
00084       offset += sizeof(this->st_cooccurrence);
00085         memcpy( &(this->cooccurrence[i]), &(this->st_cooccurrence), sizeof(float));
00086       }
00087      return offset;
00088     }
00089 
00090     const char * getType(){ return "object_recognition_msgs/RecognizedObjectArray"; };
00091     const char * getMD5(){ return "bad6b1546b9ebcabb49fb3b858d78964"; };
00092 
00093   };
00094 
00095 }
00096 #endif


ric_mc
Author(s): RoboTiCan
autogenerated on Fri May 20 2016 03:48:56