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