forked from vislab-tecnico-lisboa/KinectBody2Yarp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstd_msgs_Header.h
126 lines (102 loc) · 3.54 KB
/
std_msgs_Header.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// This is an automatically generated file.
// Generated from this std_msgs_Header.msg definition:
// uint32 seq
// time stamp
// string frame_id
// Instances of this class can be read and written with YARP ports,
// using a ROS-compatible format.
#ifndef YARPMSG_TYPE_std_msgs_Header
#define YARPMSG_TYPE_std_msgs_Header
#include <string>
#include <vector>
#include <yarp/os/Wire.h>
#include <yarp/os/idl/WireTypes.h>
#include "FloorPlane.h"
#include "geometry_msgs_Point.h"
#include "geometry_msgs_Quaternion.h"
#include "geometry_msgs_Pose.h"
#include "JointROSmsg.h"
#include "Body.h"
#include "TickTime.h"
class std_msgs_Header : public yarp::os::idl::WirePortable {
public:
yarp::os::NetUint32 seq;
TickTime stamp;
std::string frame_id;
std_msgs_Header() {
}
bool readBare(yarp::os::ConnectionReader& connection) {
// *** seq ***
seq = connection.expectInt();
// *** stamp ***
if (!stamp.read(connection)) return false;
// *** frame_id ***
int len = connection.expectInt();
frame_id.resize(len);
if (!connection.expectBlock((char*)frame_id.c_str(),len)) return false;
return !connection.isError();
}
bool readBottle(yarp::os::ConnectionReader& connection) {
connection.convertTextMode();
yarp::os::idl::WireReader reader(connection);
if (!reader.readListHeader(3)) return false;
// *** seq ***
seq = reader.expectInt();
// *** stamp ***
if (!stamp.read(connection)) return false;
// *** frame_id ***
if (!reader.readString(frame_id)) return false;
return !connection.isError();
}
bool read(yarp::os::ConnectionReader& connection) {
if (connection.isBareMode()) return readBare(connection);
return readBottle(connection);
}
bool writeBare(yarp::os::ConnectionWriter& connection) {
// *** seq ***
connection.appendInt(seq);
// *** stamp ***
if (!stamp.write(connection)) return false;
// *** frame_id ***
connection.appendInt(frame_id.length());
connection.appendExternalBlock((char*)frame_id.c_str(),frame_id.length());
return !connection.isError();
}
bool writeBottle(yarp::os::ConnectionWriter& connection) {
connection.appendInt(BOTTLE_TAG_LIST);
connection.appendInt(3);
// *** seq ***
connection.appendInt(BOTTLE_TAG_INT);
connection.appendInt((int)seq);
// *** stamp ***
if (!stamp.write(connection)) return false;
// *** frame_id ***
connection.appendInt(BOTTLE_TAG_STRING);
connection.appendInt(frame_id.length());
connection.appendExternalBlock((char*)frame_id.c_str(),frame_id.length());
connection.convertTextMode();
return !connection.isError();
}
bool write(yarp::os::ConnectionWriter& connection) {
if (connection.isBareMode()) return writeBare(connection);
return writeBottle(connection);
}
// This class will serialize ROS style or YARP style depending on protocol.
// If you need to force a serialization style, use one of these classes:
typedef yarp::os::idl::BareStyle<std_msgs_Header> rosStyle;
typedef yarp::os::idl::BottleStyle<std_msgs_Header> bottleStyle;
// Give source text for class, ROS will need this
yarp::os::ConstString getTypeText() {
return "uint32 seq\n\
time stamp\n\
string frame_id";
}
// Name the class, ROS will need this
yarp::os::Type getType() {
yarp::os::Type typ = yarp::os::Type::byName("std_msgs/Header","std_msgs/Header");
typ.addProperty("md5sum",yarp::os::Value("2176decaecbce78abc3b96ef049fabed"));
typ.addProperty("message_definition",yarp::os::Value(getTypeText()));
return typ;
}
};
#endif