AllowedCollisionMatrix.h
Go to the documentation of this file.
00001 #ifndef _ROS_moveit_msgs_AllowedCollisionMatrix_h
00002 #define _ROS_moveit_msgs_AllowedCollisionMatrix_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "moveit_msgs/AllowedCollisionEntry.h"
00009 
00010 namespace moveit_msgs
00011 {
00012 
00013   class AllowedCollisionMatrix : public ros::Msg
00014   {
00015     public:
00016       uint8_t entry_names_length;
00017       char* st_entry_names;
00018       char* * entry_names;
00019       uint8_t entry_values_length;
00020       moveit_msgs::AllowedCollisionEntry st_entry_values;
00021       moveit_msgs::AllowedCollisionEntry * entry_values;
00022       uint8_t default_entry_names_length;
00023       char* st_default_entry_names;
00024       char* * default_entry_names;
00025       uint8_t default_entry_values_length;
00026       bool st_default_entry_values;
00027       bool * default_entry_values;
00028 
00029     virtual int serialize(unsigned char *outbuffer) const
00030     {
00031       int offset = 0;
00032       *(outbuffer + offset++) = entry_names_length;
00033       *(outbuffer + offset++) = 0;
00034       *(outbuffer + offset++) = 0;
00035       *(outbuffer + offset++) = 0;
00036       for( uint8_t i = 0; i < entry_names_length; i++){
00037       uint32_t length_entry_namesi = strlen(this->entry_names[i]);
00038       memcpy(outbuffer + offset, &length_entry_namesi, sizeof(uint32_t));
00039       offset += 4;
00040       memcpy(outbuffer + offset, this->entry_names[i], length_entry_namesi);
00041       offset += length_entry_namesi;
00042       }
00043       *(outbuffer + offset++) = entry_values_length;
00044       *(outbuffer + offset++) = 0;
00045       *(outbuffer + offset++) = 0;
00046       *(outbuffer + offset++) = 0;
00047       for( uint8_t i = 0; i < entry_values_length; i++){
00048       offset += this->entry_values[i].serialize(outbuffer + offset);
00049       }
00050       *(outbuffer + offset++) = default_entry_names_length;
00051       *(outbuffer + offset++) = 0;
00052       *(outbuffer + offset++) = 0;
00053       *(outbuffer + offset++) = 0;
00054       for( uint8_t i = 0; i < default_entry_names_length; i++){
00055       uint32_t length_default_entry_namesi = strlen(this->default_entry_names[i]);
00056       memcpy(outbuffer + offset, &length_default_entry_namesi, sizeof(uint32_t));
00057       offset += 4;
00058       memcpy(outbuffer + offset, this->default_entry_names[i], length_default_entry_namesi);
00059       offset += length_default_entry_namesi;
00060       }
00061       *(outbuffer + offset++) = default_entry_values_length;
00062       *(outbuffer + offset++) = 0;
00063       *(outbuffer + offset++) = 0;
00064       *(outbuffer + offset++) = 0;
00065       for( uint8_t i = 0; i < default_entry_values_length; i++){
00066       union {
00067         bool real;
00068         uint8_t base;
00069       } u_default_entry_valuesi;
00070       u_default_entry_valuesi.real = this->default_entry_values[i];
00071       *(outbuffer + offset + 0) = (u_default_entry_valuesi.base >> (8 * 0)) & 0xFF;
00072       offset += sizeof(this->default_entry_values[i]);
00073       }
00074       return offset;
00075     }
00076 
00077     virtual int deserialize(unsigned char *inbuffer)
00078     {
00079       int offset = 0;
00080       uint8_t entry_names_lengthT = *(inbuffer + offset++);
00081       if(entry_names_lengthT > entry_names_length)
00082         this->entry_names = (char**)realloc(this->entry_names, entry_names_lengthT * sizeof(char*));
00083       offset += 3;
00084       entry_names_length = entry_names_lengthT;
00085       for( uint8_t i = 0; i < entry_names_length; i++){
00086       uint32_t length_st_entry_names;
00087       memcpy(&length_st_entry_names, (inbuffer + offset), sizeof(uint32_t));
00088       offset += 4;
00089       for(unsigned int k= offset; k< offset+length_st_entry_names; ++k){
00090           inbuffer[k-1]=inbuffer[k];
00091       }
00092       inbuffer[offset+length_st_entry_names-1]=0;
00093       this->st_entry_names = (char *)(inbuffer + offset-1);
00094       offset += length_st_entry_names;
00095         memcpy( &(this->entry_names[i]), &(this->st_entry_names), sizeof(char*));
00096       }
00097       uint8_t entry_values_lengthT = *(inbuffer + offset++);
00098       if(entry_values_lengthT > entry_values_length)
00099         this->entry_values = (moveit_msgs::AllowedCollisionEntry*)realloc(this->entry_values, entry_values_lengthT * sizeof(moveit_msgs::AllowedCollisionEntry));
00100       offset += 3;
00101       entry_values_length = entry_values_lengthT;
00102       for( uint8_t i = 0; i < entry_values_length; i++){
00103       offset += this->st_entry_values.deserialize(inbuffer + offset);
00104         memcpy( &(this->entry_values[i]), &(this->st_entry_values), sizeof(moveit_msgs::AllowedCollisionEntry));
00105       }
00106       uint8_t default_entry_names_lengthT = *(inbuffer + offset++);
00107       if(default_entry_names_lengthT > default_entry_names_length)
00108         this->default_entry_names = (char**)realloc(this->default_entry_names, default_entry_names_lengthT * sizeof(char*));
00109       offset += 3;
00110       default_entry_names_length = default_entry_names_lengthT;
00111       for( uint8_t i = 0; i < default_entry_names_length; i++){
00112       uint32_t length_st_default_entry_names;
00113       memcpy(&length_st_default_entry_names, (inbuffer + offset), sizeof(uint32_t));
00114       offset += 4;
00115       for(unsigned int k= offset; k< offset+length_st_default_entry_names; ++k){
00116           inbuffer[k-1]=inbuffer[k];
00117       }
00118       inbuffer[offset+length_st_default_entry_names-1]=0;
00119       this->st_default_entry_names = (char *)(inbuffer + offset-1);
00120       offset += length_st_default_entry_names;
00121         memcpy( &(this->default_entry_names[i]), &(this->st_default_entry_names), sizeof(char*));
00122       }
00123       uint8_t default_entry_values_lengthT = *(inbuffer + offset++);
00124       if(default_entry_values_lengthT > default_entry_values_length)
00125         this->default_entry_values = (bool*)realloc(this->default_entry_values, default_entry_values_lengthT * sizeof(bool));
00126       offset += 3;
00127       default_entry_values_length = default_entry_values_lengthT;
00128       for( uint8_t i = 0; i < default_entry_values_length; i++){
00129       union {
00130         bool real;
00131         uint8_t base;
00132       } u_st_default_entry_values;
00133       u_st_default_entry_values.base = 0;
00134       u_st_default_entry_values.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00135       this->st_default_entry_values = u_st_default_entry_values.real;
00136       offset += sizeof(this->st_default_entry_values);
00137         memcpy( &(this->default_entry_values[i]), &(this->st_default_entry_values), sizeof(bool));
00138       }
00139      return offset;
00140     }
00141 
00142     const char * getType(){ return "moveit_msgs/AllowedCollisionMatrix"; };
00143     const char * getMD5(){ return "aedce13587eef0d79165a075659c1879"; };
00144 
00145   };
00146 
00147 }
00148 #endif


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