Working towards recieving twists

Dependencies:   BufferedSerial

Fork of ros_lib_kinetic by Gary Servin

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TwoInts.h Source File

TwoInts.h

00001 #ifndef _ROS_SERVICE_TwoInts_h
00002 #define _ROS_SERVICE_TwoInts_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 
00008 namespace roscpp_tutorials
00009 {
00010 
00011 static const char TWOINTS[] = "roscpp_tutorials/TwoInts";
00012 
00013   class TwoIntsRequest : public ros::Msg
00014   {
00015     public:
00016       typedef int64_t _a_type;
00017       _a_type a;
00018       typedef int64_t _b_type;
00019       _b_type b;
00020 
00021     TwoIntsRequest():
00022       a(0),
00023       b(0)
00024     {
00025     }
00026 
00027     virtual int serialize(unsigned char *outbuffer) const
00028     {
00029       int offset = 0;
00030       union {
00031         int64_t real;
00032         uint64_t base;
00033       } u_a;
00034       u_a.real = this->a;
00035       *(outbuffer + offset + 0) = (u_a.base >> (8 * 0)) & 0xFF;
00036       *(outbuffer + offset + 1) = (u_a.base >> (8 * 1)) & 0xFF;
00037       *(outbuffer + offset + 2) = (u_a.base >> (8 * 2)) & 0xFF;
00038       *(outbuffer + offset + 3) = (u_a.base >> (8 * 3)) & 0xFF;
00039       *(outbuffer + offset + 4) = (u_a.base >> (8 * 4)) & 0xFF;
00040       *(outbuffer + offset + 5) = (u_a.base >> (8 * 5)) & 0xFF;
00041       *(outbuffer + offset + 6) = (u_a.base >> (8 * 6)) & 0xFF;
00042       *(outbuffer + offset + 7) = (u_a.base >> (8 * 7)) & 0xFF;
00043       offset += sizeof(this->a);
00044       union {
00045         int64_t real;
00046         uint64_t base;
00047       } u_b;
00048       u_b.real = this->b;
00049       *(outbuffer + offset + 0) = (u_b.base >> (8 * 0)) & 0xFF;
00050       *(outbuffer + offset + 1) = (u_b.base >> (8 * 1)) & 0xFF;
00051       *(outbuffer + offset + 2) = (u_b.base >> (8 * 2)) & 0xFF;
00052       *(outbuffer + offset + 3) = (u_b.base >> (8 * 3)) & 0xFF;
00053       *(outbuffer + offset + 4) = (u_b.base >> (8 * 4)) & 0xFF;
00054       *(outbuffer + offset + 5) = (u_b.base >> (8 * 5)) & 0xFF;
00055       *(outbuffer + offset + 6) = (u_b.base >> (8 * 6)) & 0xFF;
00056       *(outbuffer + offset + 7) = (u_b.base >> (8 * 7)) & 0xFF;
00057       offset += sizeof(this->b);
00058       return offset;
00059     }
00060 
00061     virtual int deserialize(unsigned char *inbuffer)
00062     {
00063       int offset = 0;
00064       union {
00065         int64_t real;
00066         uint64_t base;
00067       } u_a;
00068       u_a.base = 0;
00069       u_a.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00070       u_a.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00071       u_a.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00072       u_a.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00073       u_a.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00074       u_a.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00075       u_a.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00076       u_a.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00077       this->a = u_a.real;
00078       offset += sizeof(this->a);
00079       union {
00080         int64_t real;
00081         uint64_t base;
00082       } u_b;
00083       u_b.base = 0;
00084       u_b.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00085       u_b.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00086       u_b.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00087       u_b.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00088       u_b.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00089       u_b.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00090       u_b.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00091       u_b.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00092       this->b = u_b.real;
00093       offset += sizeof(this->b);
00094      return offset;
00095     }
00096 
00097     const char * getType(){ return TWOINTS; };
00098     const char * getMD5(){ return "36d09b846be0b371c5f190354dd3153e"; };
00099 
00100   };
00101 
00102   class TwoIntsResponse : public ros::Msg
00103   {
00104     public:
00105       typedef int64_t _sum_type;
00106       _sum_type sum;
00107 
00108     TwoIntsResponse():
00109       sum(0)
00110     {
00111     }
00112 
00113     virtual int serialize(unsigned char *outbuffer) const
00114     {
00115       int offset = 0;
00116       union {
00117         int64_t real;
00118         uint64_t base;
00119       } u_sum;
00120       u_sum.real = this->sum;
00121       *(outbuffer + offset + 0) = (u_sum.base >> (8 * 0)) & 0xFF;
00122       *(outbuffer + offset + 1) = (u_sum.base >> (8 * 1)) & 0xFF;
00123       *(outbuffer + offset + 2) = (u_sum.base >> (8 * 2)) & 0xFF;
00124       *(outbuffer + offset + 3) = (u_sum.base >> (8 * 3)) & 0xFF;
00125       *(outbuffer + offset + 4) = (u_sum.base >> (8 * 4)) & 0xFF;
00126       *(outbuffer + offset + 5) = (u_sum.base >> (8 * 5)) & 0xFF;
00127       *(outbuffer + offset + 6) = (u_sum.base >> (8 * 6)) & 0xFF;
00128       *(outbuffer + offset + 7) = (u_sum.base >> (8 * 7)) & 0xFF;
00129       offset += sizeof(this->sum);
00130       return offset;
00131     }
00132 
00133     virtual int deserialize(unsigned char *inbuffer)
00134     {
00135       int offset = 0;
00136       union {
00137         int64_t real;
00138         uint64_t base;
00139       } u_sum;
00140       u_sum.base = 0;
00141       u_sum.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00142       u_sum.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00143       u_sum.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00144       u_sum.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00145       u_sum.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00146       u_sum.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00147       u_sum.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00148       u_sum.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00149       this->sum = u_sum.real;
00150       offset += sizeof(this->sum);
00151      return offset;
00152     }
00153 
00154     const char * getType(){ return TWOINTS; };
00155     const char * getMD5(){ return "b88405221c77b1878a3cbbfff53428d7"; };
00156 
00157   };
00158 
00159   class TwoInts {
00160     public:
00161     typedef TwoIntsRequest Request;
00162     typedef TwoIntsResponse Response;
00163   };
00164 
00165 }
00166 #endif