YARP
Yet Another Robot Platform
PoseArray.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6// This is an automatically generated file.
7
8// Generated from the following "geometry_msgs/PoseArray" msg definition:
9// # An array of poses with a header for global reference.
10//
11// Header header
12//
13// Pose[] poses
14// Instances of this class can be read and written with YARP ports,
15// using a ROS-compatible format.
16
17#ifndef YARP_ROSMSG_geometry_msgs_PoseArray_h
18#define YARP_ROSMSG_geometry_msgs_PoseArray_h
19
20#include <yarp/os/Wire.h>
23#include <string>
24#include <vector>
27
28namespace yarp {
29namespace rosmsg {
30namespace geometry_msgs {
31
33{
34public:
36 std::vector<yarp::rosmsg::geometry_msgs::Pose> poses;
37
39 header(),
40 poses()
41 {
42 }
43
44 void clear()
45 {
46 // *** header ***
47 header.clear();
48
49 // *** poses ***
50 poses.clear();
51 }
52
53 bool readBare(yarp::os::ConnectionReader& connection) override
54 {
55 // *** header ***
56 if (!header.read(connection)) {
57 return false;
58 }
59
60 // *** poses ***
61 int len = connection.expectInt32();
62 poses.resize(len);
63 for (int i=0; i<len; i++) {
64 if (!poses[i].read(connection)) {
65 return false;
66 }
67 }
68
69 return !connection.isError();
70 }
71
72 bool readBottle(yarp::os::ConnectionReader& connection) override
73 {
74 connection.convertTextMode();
75 yarp::os::idl::WireReader reader(connection);
76 if (!reader.readListHeader(2)) {
77 return false;
78 }
79
80 // *** header ***
81 if (!header.read(connection)) {
82 return false;
83 }
84
85 // *** poses ***
86 if (connection.expectInt32() != BOTTLE_TAG_LIST) {
87 return false;
88 }
89 int len = connection.expectInt32();
90 poses.resize(len);
91 for (int i=0; i<len; i++) {
92 if (!poses[i].read(connection)) {
93 return false;
94 }
95 }
96
97 return !connection.isError();
98 }
99
101 bool read(yarp::os::ConnectionReader& connection) override
102 {
103 return (connection.isBareMode() ? readBare(connection)
104 : readBottle(connection));
105 }
106
107 bool writeBare(yarp::os::ConnectionWriter& connection) const override
108 {
109 // *** header ***
110 if (!header.write(connection)) {
111 return false;
112 }
113
114 // *** poses ***
115 connection.appendInt32(poses.size());
116 for (size_t i=0; i<poses.size(); i++) {
117 if (!poses[i].write(connection)) {
118 return false;
119 }
120 }
121
122 return !connection.isError();
123 }
124
125 bool writeBottle(yarp::os::ConnectionWriter& connection) const override
126 {
127 connection.appendInt32(BOTTLE_TAG_LIST);
128 connection.appendInt32(2);
129
130 // *** header ***
131 if (!header.write(connection)) {
132 return false;
133 }
134
135 // *** poses ***
136 connection.appendInt32(BOTTLE_TAG_LIST);
137 connection.appendInt32(poses.size());
138 for (size_t i=0; i<poses.size(); i++) {
139 if (!poses[i].write(connection)) {
140 return false;
141 }
142 }
143
144 connection.convertTextMode();
145 return !connection.isError();
146 }
147
149 bool write(yarp::os::ConnectionWriter& connection) const override
150 {
151 return (connection.isBareMode() ? writeBare(connection)
152 : writeBottle(connection));
153 }
154
155 // This class will serialize ROS style or YARP style depending on protocol.
156 // If you need to force a serialization style, use one of these classes:
159
160 // The name for this message, ROS will need this
161 static constexpr const char* typeName = "geometry_msgs/PoseArray";
162
163 // The checksum for this message, ROS will need this
164 static constexpr const char* typeChecksum = "916c28c5764443f268b296bb671b9d97";
165
166 // The source text for this message, ROS will need this
167 static constexpr const char* typeText = "\
168# An array of poses with a header for global reference.\n\
169\n\
170Header header\n\
171\n\
172Pose[] poses\n\
173\n\
174================================================================================\n\
175MSG: std_msgs/Header\n\
176# Standard metadata for higher-level stamped data types.\n\
177# This is generally used to communicate timestamped data \n\
178# in a particular coordinate frame.\n\
179# \n\
180# sequence ID: consecutively increasing ID \n\
181uint32 seq\n\
182#Two-integer timestamp that is expressed as:\n\
183# * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
184# * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
185# time-handling sugar is provided by the client library\n\
186time stamp\n\
187#Frame this data is associated with\n\
188# 0: no frame\n\
189# 1: global frame\n\
190string frame_id\n\
191\n\
192================================================================================\n\
193MSG: geometry_msgs/Pose\n\
194# A representation of pose in free space, composed of position and orientation. \n\
195Point position\n\
196Quaternion orientation\n\
197\n\
198================================================================================\n\
199MSG: geometry_msgs/Point\n\
200# This contains the position of a point in free space\n\
201float64 x\n\
202float64 y\n\
203float64 z\n\
204\n\
205================================================================================\n\
206MSG: geometry_msgs/Quaternion\n\
207# This represents an orientation in free space in quaternion form.\n\
208\n\
209float64 x\n\
210float64 y\n\
211float64 z\n\
212float64 w\n\
213";
214
215 yarp::os::Type getType() const override
216 {
219 typ.addProperty("message_definition", yarp::os::Value(typeText));
220 return typ;
221 }
222};
223
224} // namespace geometry_msgs
225} // namespace rosmsg
226} // namespace yarp
227
228#endif // YARP_ROSMSG_geometry_msgs_PoseArray_h
#define BOTTLE_TAG_LIST
Definition: Bottle.h:28
An interface for reading from a network connection.
virtual bool isBareMode() const =0
Check if the connection is bare mode.
virtual std::int32_t expectInt32()=0
Read a 32-bit integer from the network connection.
virtual bool convertTextMode()=0
Reads in a standard description in text mode, and converts it to a standard description in binary.
virtual bool isError() const =0
An interface for writing to a network connection.
virtual bool isError() const =0
virtual bool isBareMode() const =0
Check if the connection is bare mode.
virtual bool convertTextMode()=0
Converts a standard description in binary into a textual description, if the connection is in text-mo...
virtual void appendInt32(std::int32_t data)=0
Send a representation of a 32-bit integer to the network connection.
static Type byName(const char *name)
Definition: Type.cpp:171
Type & addProperty(const char *key, const Value &val)
Definition: Type.cpp:134
A single value (typically within a Bottle).
Definition: Value.h:43
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:21
virtual bool read(yarp::os::idl::WireReader &reader)
virtual bool write(const yarp::os::idl::WireWriter &writer) const
IDL-friendly connection reader.
Definition: WireReader.h:27
yarp::os::idl::BareStyle< yarp::rosmsg::geometry_msgs::PoseArray > rosStyle
Definition: PoseArray.h:157
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: PoseArray.h:125
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: PoseArray.h:101
static constexpr const char * typeText
Definition: PoseArray.h:167
static constexpr const char * typeChecksum
Definition: PoseArray.h:164
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: PoseArray.h:72
static constexpr const char * typeName
Definition: PoseArray.h:161
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: PoseArray.h:149
yarp::os::idl::BottleStyle< yarp::rosmsg::geometry_msgs::PoseArray > bottleStyle
Definition: PoseArray.h:158
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: PoseArray.h:107
std::vector< yarp::rosmsg::geometry_msgs::Pose > poses
Definition: PoseArray.h:36
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: PoseArray.h:53
yarp::rosmsg::std_msgs::Header header
Definition: PoseArray.h:35
yarp::os::Type getType() const override
Definition: PoseArray.h:215
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Header.h:159
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Header.h:112
The main, catch-all namespace for YARP.
Definition: dirs.h:16