Project

General

Profile

Statistics
| Branch: | Revision:

root / quad2 / arduino / src / ros_lib / roscpp / GetLoggers.h @ c1426757

History | View | Annotate | Download (2 KB)

1 c1426757 Tom Mullins
#ifndef _ROS_SERVICE_GetLoggers_h
2
#define _ROS_SERVICE_GetLoggers_h
3
#include <stdint.h>
4
#include <string.h>
5
#include <stdlib.h>
6
#include "ros/msg.h"
7
#include "roscpp/Logger.h"
8
9
namespace roscpp
10
{
11
12
static const char GETLOGGERS[] = "roscpp/GetLoggers";
13
14
  class GetLoggersRequest : public ros::Msg
15
  {
16
    public:
17
18
    virtual int serialize(unsigned char *outbuffer) const
19
    {
20
      int offset = 0;
21
      return offset;
22
    }
23
24
    virtual int deserialize(unsigned char *inbuffer)
25
    {
26
      int offset = 0;
27
     return offset;
28
    }
29
30
    const char * getType(){ return GETLOGGERS; };
31
    const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; };
32
33
  };
34
35
  class GetLoggersResponse : public ros::Msg
36
  {
37
    public:
38
      uint8_t loggers_length;
39
      roscpp::Logger st_loggers;
40
      roscpp::Logger * loggers;
41
42
    virtual int serialize(unsigned char *outbuffer) const
43
    {
44
      int offset = 0;
45
      *(outbuffer + offset++) = loggers_length;
46
      *(outbuffer + offset++) = 0;
47
      *(outbuffer + offset++) = 0;
48
      *(outbuffer + offset++) = 0;
49
      for( uint8_t i = 0; i < loggers_length; i++){
50
      offset += this->loggers[i].serialize(outbuffer + offset);
51
      }
52
      return offset;
53
    }
54
55
    virtual int deserialize(unsigned char *inbuffer)
56
    {
57
      int offset = 0;
58
      uint8_t loggers_lengthT = *(inbuffer + offset++);
59
      if(loggers_lengthT > loggers_length)
60
        this->loggers = (roscpp::Logger*)realloc(this->loggers, loggers_lengthT * sizeof(roscpp::Logger));
61
      offset += 3;
62
      loggers_length = loggers_lengthT;
63
      for( uint8_t i = 0; i < loggers_length; i++){
64
      offset += this->st_loggers.deserialize(inbuffer + offset);
65
        memcpy( &(this->loggers[i]), &(this->st_loggers), sizeof(roscpp::Logger));
66
      }
67
     return offset;
68
    }
69
70
    const char * getType(){ return GETLOGGERS; };
71
    const char * getMD5(){ return "32e97e85527d4678a8f9279894bb64b0"; };
72
73
  };
74
75
  class GetLoggers {
76
    public:
77
    typedef GetLoggersRequest Request;
78
    typedef GetLoggersResponse Response;
79
  };
80
81
}
82
#endif