kitt_platform
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros
Log.h
Go to the documentation of this file.
1 #ifndef _ROS_rosserial_msgs_Log_h
2 #define _ROS_rosserial_msgs_Log_h
3 
4 #include <stdint.h>
5 #include <string.h>
6 #include <stdlib.h>
7 #include "ros/msg.h"
8 
9 namespace rosserial_msgs
10 {
11 
12  class Log : public ros::Msg
13  {
14  public:
15  uint8_t level;
16  const char* msg;
17  enum { ROSDEBUG = 0 };
18  enum { INFO = 1 };
19  enum { WARN = 2 };
20  enum { ERROR = 3 };
21  enum { FATAL = 4 };
22 
23  Log():
24  level(0),
25  msg("")
26  {
27  }
28 
29  virtual int serialize(unsigned char *outbuffer) const
30  {
31  int offset = 0;
32  *(outbuffer + offset + 0) = (this->level >> (8 * 0)) & 0xFF;
33  offset += sizeof(this->level);
34  uint32_t length_msg = strlen(this->msg);
35  memcpy(outbuffer + offset, &length_msg, sizeof(uint32_t));
36  offset += 4;
37  memcpy(outbuffer + offset, this->msg, length_msg);
38  offset += length_msg;
39  return offset;
40  }
41 
42  virtual int deserialize(unsigned char *inbuffer)
43  {
44  int offset = 0;
45  this->level = ((uint8_t) (*(inbuffer + offset)));
46  offset += sizeof(this->level);
47  uint32_t length_msg;
48  memcpy(&length_msg, (inbuffer + offset), sizeof(uint32_t));
49  offset += 4;
50  for(unsigned int k= offset; k< offset+length_msg; ++k){
51  inbuffer[k-1]=inbuffer[k];
52  }
53  inbuffer[offset+length_msg-1]=0;
54  this->msg = (char *)(inbuffer + offset-1);
55  offset += length_msg;
56  return offset;
57  }
58 
59  const char * getType(){ return "rosserial_msgs/Log"; };
60  const char * getMD5(){ return "11abd731c25933261cd6183bd12d6295"; };
61 
62  };
63 
64 }
65 #endif
Log()
Definition: Log.h:23
Definition: Log.h:20
Definition: Log.h:21
Definition: Log.h:12
Definition: Log.h:18
uint8_t level
Definition: Log.h:15
Definition: Log.h:17
const char * getType()
Definition: Log.h:59
virtual int deserialize(unsigned char *inbuffer)
Definition: Log.h:42
Definition: Log.h:19
const char * getMD5()
Definition: Log.h:60
Definition: msg.h:43
virtual int serialize(unsigned char *outbuffer) const
Definition: Log.h:29
const char * msg
Definition: Log.h:16