Statistics
| Branch: | Revision:

root / quad2 / arduino / src / ros_lib / std_msgs / Time.h @ c1426757

History | View | Annotate | Download (1.91 KB)

1
#ifndef _ROS_std_msgs_Time_h
2
#define _ROS_std_msgs_Time_h
3

    
4
#include <stdint.h>
5
#include <string.h>
6
#include <stdlib.h>
7
#include "ros/msg.h"
8
#include "ros/time.h"
9

    
10
namespace std_msgs
11
{
12

    
13
  class Time : public ros::Msg
14
  {
15
    public:
16
      ros::Time data;
17

    
18
    virtual int serialize(unsigned char *outbuffer) const
19
    {
20
      int offset = 0;
21
      *(outbuffer + offset + 0) = (this->data.sec >> (8 * 0)) & 0xFF;
22
      *(outbuffer + offset + 1) = (this->data.sec >> (8 * 1)) & 0xFF;
23
      *(outbuffer + offset + 2) = (this->data.sec >> (8 * 2)) & 0xFF;
24
      *(outbuffer + offset + 3) = (this->data.sec >> (8 * 3)) & 0xFF;
25
      offset += sizeof(this->data.sec);
26
      *(outbuffer + offset + 0) = (this->data.nsec >> (8 * 0)) & 0xFF;
27
      *(outbuffer + offset + 1) = (this->data.nsec >> (8 * 1)) & 0xFF;
28
      *(outbuffer + offset + 2) = (this->data.nsec >> (8 * 2)) & 0xFF;
29
      *(outbuffer + offset + 3) = (this->data.nsec >> (8 * 3)) & 0xFF;
30
      offset += sizeof(this->data.nsec);
31
      return offset;
32
    }
33

    
34
    virtual int deserialize(unsigned char *inbuffer)
35
    {
36
      int offset = 0;
37
      this->data.sec |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
38
      this->data.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
39
      this->data.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
40
      this->data.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
41
      offset += sizeof(this->data.sec);
42
      this->data.nsec |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
43
      this->data.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
44
      this->data.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
45
      this->data.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
46
      offset += sizeof(this->data.nsec);
47
     return offset;
48
    }
49

    
50
    const char * getType(){ return "std_msgs/Time"; };
51
    const char * getMD5(){ return "cd7166c74c552c311fbcc2fe5a7bc289"; };
52

    
53
  };
54

    
55
}
56
#endif