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

Int16.h

00001 #ifndef _ROS_std_msgs_Int16_h
00002 #define _ROS_std_msgs_Int16_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace std_msgs
00010 {
00011 
00012   class Int16 : public ros::Msg
00013   {
00014     public:
00015       typedef int16_t _data_type;
00016       _data_type data;
00017 
00018     Int16():
00019       data(0)
00020     {
00021     }
00022 
00023     virtual int serialize(unsigned char *outbuffer) const
00024     {
00025       int offset = 0;
00026       union {
00027         int16_t real;
00028         uint16_t base;
00029       } u_data;
00030       u_data.real = this->data;
00031       *(outbuffer + offset + 0) = (u_data.base >> (8 * 0)) & 0xFF;
00032       *(outbuffer + offset + 1) = (u_data.base >> (8 * 1)) & 0xFF;
00033       offset += sizeof(this->data);
00034       return offset;
00035     }
00036 
00037     virtual int deserialize(unsigned char *inbuffer)
00038     {
00039       int offset = 0;
00040       union {
00041         int16_t real;
00042         uint16_t base;
00043       } u_data;
00044       u_data.base = 0;
00045       u_data.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0);
00046       u_data.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
00047       this->data = u_data.real;
00048       offset += sizeof(this->data);
00049      return offset;
00050     }
00051 
00052     const char * getType(){ return "std_msgs/Int16"; };
00053     const char * getMD5(){ return "8524586e34fbd7cb1c08c5f5f1ca0e57"; };
00054 
00055   };
00056 
00057 }
00058 #endif