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 RotatedRectArray.h Source File

RotatedRectArray.h

00001 #ifndef _ROS_opencv_apps_RotatedRectArray_h
00002 #define _ROS_opencv_apps_RotatedRectArray_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "opencv_apps/RotatedRect.h"
00009 
00010 namespace opencv_apps
00011 {
00012 
00013   class RotatedRectArray : public ros::Msg
00014   {
00015     public:
00016       uint8_t rects_length;
00017       opencv_apps::RotatedRect st_rects;
00018       opencv_apps::RotatedRect * rects;
00019 
00020     RotatedRectArray():
00021       rects_length(0), rects(NULL)
00022     {
00023     }
00024 
00025     virtual int serialize(unsigned char *outbuffer) const
00026     {
00027       int offset = 0;
00028       *(outbuffer + offset++) = rects_length;
00029       *(outbuffer + offset++) = 0;
00030       *(outbuffer + offset++) = 0;
00031       *(outbuffer + offset++) = 0;
00032       for( uint8_t i = 0; i < rects_length; i++){
00033       offset += this->rects[i].serialize(outbuffer + offset);
00034       }
00035       return offset;
00036     }
00037 
00038     virtual int deserialize(unsigned char *inbuffer)
00039     {
00040       int offset = 0;
00041       uint8_t rects_lengthT = *(inbuffer + offset++);
00042       if(rects_lengthT > rects_length)
00043         this->rects = (opencv_apps::RotatedRect*)realloc(this->rects, rects_lengthT * sizeof(opencv_apps::RotatedRect));
00044       offset += 3;
00045       rects_length = rects_lengthT;
00046       for( uint8_t i = 0; i < rects_length; i++){
00047       offset += this->st_rects.deserialize(inbuffer + offset);
00048         memcpy( &(this->rects[i]), &(this->st_rects), sizeof(opencv_apps::RotatedRect));
00049       }
00050      return offset;
00051     }
00052 
00053     const char * getType(){ return "opencv_apps/RotatedRectArray"; };
00054     const char * getMD5(){ return "a27e397ed2b5b1a633561d324f64d2a6"; };
00055 
00056   };
00057 
00058 }
00059 #endif