TimeReference.h
Go to the documentation of this file.
00001 #ifndef _ROS_sensor_msgs_TimeReference_h
00002 #define _ROS_sensor_msgs_TimeReference_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "std_msgs/Header.h"
00009 #include "ros/time.h"
00010 
00011 namespace sensor_msgs
00012 {
00013 
00014   class TimeReference : public ros::Msg
00015   {
00016     public:
00017       std_msgs::Header header;
00018       ros::Time time_ref;
00019       const char* source;
00020 
00021     virtual int serialize(unsigned char *outbuffer) const
00022     {
00023       int offset = 0;
00024       offset += this->header.serialize(outbuffer + offset);
00025       *(outbuffer + offset + 0) = (this->time_ref.sec >> (8 * 0)) & 0xFF;
00026       *(outbuffer + offset + 1) = (this->time_ref.sec >> (8 * 1)) & 0xFF;
00027       *(outbuffer + offset + 2) = (this->time_ref.sec >> (8 * 2)) & 0xFF;
00028       *(outbuffer + offset + 3) = (this->time_ref.sec >> (8 * 3)) & 0xFF;
00029       offset += sizeof(this->time_ref.sec);
00030       *(outbuffer + offset + 0) = (this->time_ref.nsec >> (8 * 0)) & 0xFF;
00031       *(outbuffer + offset + 1) = (this->time_ref.nsec >> (8 * 1)) & 0xFF;
00032       *(outbuffer + offset + 2) = (this->time_ref.nsec >> (8 * 2)) & 0xFF;
00033       *(outbuffer + offset + 3) = (this->time_ref.nsec >> (8 * 3)) & 0xFF;
00034       offset += sizeof(this->time_ref.nsec);
00035       uint32_t length_source = strlen(this->source);
00036       memcpy(outbuffer + offset, &length_source, sizeof(uint32_t));
00037       offset += 4;
00038       memcpy(outbuffer + offset, this->source, length_source);
00039       offset += length_source;
00040       return offset;
00041     }
00042 
00043     virtual int deserialize(unsigned char *inbuffer)
00044     {
00045       int offset = 0;
00046       offset += this->header.deserialize(inbuffer + offset);
00047       this->time_ref.sec =  ((uint32_t) (*(inbuffer + offset)));
00048       this->time_ref.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00049       this->time_ref.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00050       this->time_ref.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00051       offset += sizeof(this->time_ref.sec);
00052       this->time_ref.nsec =  ((uint32_t) (*(inbuffer + offset)));
00053       this->time_ref.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00054       this->time_ref.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00055       this->time_ref.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00056       offset += sizeof(this->time_ref.nsec);
00057       uint32_t length_source;
00058       memcpy(&length_source, (inbuffer + offset), sizeof(uint32_t));
00059       offset += 4;
00060       for(unsigned int k= offset; k< offset+length_source; ++k){
00061           inbuffer[k-1]=inbuffer[k];
00062       }
00063       inbuffer[offset+length_source-1]=0;
00064       this->source = (char *)(inbuffer + offset-1);
00065       offset += length_source;
00066      return offset;
00067     }
00068 
00069     const char * getType(){ return "sensor_msgs/TimeReference"; };
00070     const char * getMD5(){ return "fded64a0265108ba86c3d38fb11c0c16"; };
00071 
00072   };
00073 
00074 }
00075 #endif


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