catchrobo2022 / Mbed 2 deprecated catchrobo2022_mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TransformableMarkerOperate.h Source File

TransformableMarkerOperate.h

00001 #ifndef _ROS_jsk_rviz_plugins_TransformableMarkerOperate_h
00002 #define _ROS_jsk_rviz_plugins_TransformableMarkerOperate_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace jsk_rviz_plugins
00010 {
00011 
00012   class TransformableMarkerOperate : public ros::Msg
00013   {
00014     public:
00015       typedef int32_t _type_type;
00016       _type_type type;
00017       typedef int32_t _action_type;
00018       _action_type action;
00019       typedef const char* _frame_id_type;
00020       _frame_id_type frame_id;
00021       typedef const char* _name_type;
00022       _name_type name;
00023       typedef const char* _description_type;
00024       _description_type description;
00025       typedef const char* _mesh_resource_type;
00026       _mesh_resource_type mesh_resource;
00027       typedef bool _mesh_use_embedded_materials_type;
00028       _mesh_use_embedded_materials_type mesh_use_embedded_materials;
00029       enum { BOX = 0 };
00030       enum { CYLINDER = 1 };
00031       enum { TORUS = 2 };
00032       enum { MESH_RESOURCE = 3 };
00033       enum { INSERT = 0 };
00034       enum { ERASE = 1 };
00035       enum { ERASEALL = 2 };
00036       enum { ERASEFOCUS = 3 };
00037       enum { COPY = 4 };
00038 
00039     TransformableMarkerOperate():
00040       type(0),
00041       action(0),
00042       frame_id(""),
00043       name(""),
00044       description(""),
00045       mesh_resource(""),
00046       mesh_use_embedded_materials(0)
00047     {
00048     }
00049 
00050     virtual int serialize(unsigned char *outbuffer) const
00051     {
00052       int offset = 0;
00053       union {
00054         int32_t real;
00055         uint32_t base;
00056       } u_type;
00057       u_type.real = this->type;
00058       *(outbuffer + offset + 0) = (u_type.base >> (8 * 0)) & 0xFF;
00059       *(outbuffer + offset + 1) = (u_type.base >> (8 * 1)) & 0xFF;
00060       *(outbuffer + offset + 2) = (u_type.base >> (8 * 2)) & 0xFF;
00061       *(outbuffer + offset + 3) = (u_type.base >> (8 * 3)) & 0xFF;
00062       offset += sizeof(this->type);
00063       union {
00064         int32_t real;
00065         uint32_t base;
00066       } u_action;
00067       u_action.real = this->action;
00068       *(outbuffer + offset + 0) = (u_action.base >> (8 * 0)) & 0xFF;
00069       *(outbuffer + offset + 1) = (u_action.base >> (8 * 1)) & 0xFF;
00070       *(outbuffer + offset + 2) = (u_action.base >> (8 * 2)) & 0xFF;
00071       *(outbuffer + offset + 3) = (u_action.base >> (8 * 3)) & 0xFF;
00072       offset += sizeof(this->action);
00073       uint32_t length_frame_id = strlen(this->frame_id);
00074       varToArr(outbuffer + offset, length_frame_id);
00075       offset += 4;
00076       memcpy(outbuffer + offset, this->frame_id, length_frame_id);
00077       offset += length_frame_id;
00078       uint32_t length_name = strlen(this->name);
00079       varToArr(outbuffer + offset, length_name);
00080       offset += 4;
00081       memcpy(outbuffer + offset, this->name, length_name);
00082       offset += length_name;
00083       uint32_t length_description = strlen(this->description);
00084       varToArr(outbuffer + offset, length_description);
00085       offset += 4;
00086       memcpy(outbuffer + offset, this->description, length_description);
00087       offset += length_description;
00088       uint32_t length_mesh_resource = strlen(this->mesh_resource);
00089       varToArr(outbuffer + offset, length_mesh_resource);
00090       offset += 4;
00091       memcpy(outbuffer + offset, this->mesh_resource, length_mesh_resource);
00092       offset += length_mesh_resource;
00093       union {
00094         bool real;
00095         uint8_t base;
00096       } u_mesh_use_embedded_materials;
00097       u_mesh_use_embedded_materials.real = this->mesh_use_embedded_materials;
00098       *(outbuffer + offset + 0) = (u_mesh_use_embedded_materials.base >> (8 * 0)) & 0xFF;
00099       offset += sizeof(this->mesh_use_embedded_materials);
00100       return offset;
00101     }
00102 
00103     virtual int deserialize(unsigned char *inbuffer)
00104     {
00105       int offset = 0;
00106       union {
00107         int32_t real;
00108         uint32_t base;
00109       } u_type;
00110       u_type.base = 0;
00111       u_type.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00112       u_type.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00113       u_type.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00114       u_type.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00115       this->type = u_type.real;
00116       offset += sizeof(this->type);
00117       union {
00118         int32_t real;
00119         uint32_t base;
00120       } u_action;
00121       u_action.base = 0;
00122       u_action.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00123       u_action.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00124       u_action.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00125       u_action.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00126       this->action = u_action.real;
00127       offset += sizeof(this->action);
00128       uint32_t length_frame_id;
00129       arrToVar(length_frame_id, (inbuffer + offset));
00130       offset += 4;
00131       for(unsigned int k= offset; k< offset+length_frame_id; ++k){
00132           inbuffer[k-1]=inbuffer[k];
00133       }
00134       inbuffer[offset+length_frame_id-1]=0;
00135       this->frame_id = (char *)(inbuffer + offset-1);
00136       offset += length_frame_id;
00137       uint32_t length_name;
00138       arrToVar(length_name, (inbuffer + offset));
00139       offset += 4;
00140       for(unsigned int k= offset; k< offset+length_name; ++k){
00141           inbuffer[k-1]=inbuffer[k];
00142       }
00143       inbuffer[offset+length_name-1]=0;
00144       this->name = (char *)(inbuffer + offset-1);
00145       offset += length_name;
00146       uint32_t length_description;
00147       arrToVar(length_description, (inbuffer + offset));
00148       offset += 4;
00149       for(unsigned int k= offset; k< offset+length_description; ++k){
00150           inbuffer[k-1]=inbuffer[k];
00151       }
00152       inbuffer[offset+length_description-1]=0;
00153       this->description = (char *)(inbuffer + offset-1);
00154       offset += length_description;
00155       uint32_t length_mesh_resource;
00156       arrToVar(length_mesh_resource, (inbuffer + offset));
00157       offset += 4;
00158       for(unsigned int k= offset; k< offset+length_mesh_resource; ++k){
00159           inbuffer[k-1]=inbuffer[k];
00160       }
00161       inbuffer[offset+length_mesh_resource-1]=0;
00162       this->mesh_resource = (char *)(inbuffer + offset-1);
00163       offset += length_mesh_resource;
00164       union {
00165         bool real;
00166         uint8_t base;
00167       } u_mesh_use_embedded_materials;
00168       u_mesh_use_embedded_materials.base = 0;
00169       u_mesh_use_embedded_materials.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00170       this->mesh_use_embedded_materials = u_mesh_use_embedded_materials.real;
00171       offset += sizeof(this->mesh_use_embedded_materials);
00172      return offset;
00173     }
00174 
00175     virtual const char * getType(){ return "jsk_rviz_plugins/TransformableMarkerOperate"; };
00176     virtual const char * getMD5(){ return "3f5042567d7e11634fa94e4b5452169c"; };
00177 
00178   };
00179 
00180 }
00181 #endif