Project

General

Profile

Statistics
| Branch: | Revision:

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

History | View | Annotate | Download (1.94 KB)

1 c1426757 Tom Mullins
#ifndef _ROS_std_msgs_Duration_h
2
#define _ROS_std_msgs_Duration_h
3
4
#include <stdint.h>
5
#include <string.h>
6
#include <stdlib.h>
7
#include "ros/msg.h"
8
#include "ros/duration.h"
9
10
namespace std_msgs
11
{
12
13
  class Duration : public ros::Msg
14
  {
15
    public:
16
      ros::Duration 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/Duration"; };
51
    const char * getMD5(){ return "3e286caf4241d664e55f3ad380e2ae46"; };
52
53
  };
54
55
}
56
#endif