YARP
Yet Another Robot Platform
PolygonStamped.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/PolygonStamped" msg definition:
9 // # This represents a Polygon with reference coordinate frame and timestamp
10 // Header header
11 // Polygon polygon
12 // Instances of this class can be read and written with YARP ports,
13 // using a ROS-compatible format.
14 
15 #ifndef YARP_ROSMSG_geometry_msgs_PolygonStamped_h
16 #define YARP_ROSMSG_geometry_msgs_PolygonStamped_h
17 
18 #include <yarp/os/Wire.h>
19 #include <yarp/os/Type.h>
20 #include <yarp/os/idl/WireTypes.h>
21 #include <string>
22 #include <vector>
25 
26 namespace yarp {
27 namespace rosmsg {
28 namespace geometry_msgs {
29 
31 {
32 public:
35 
37  header(),
38  polygon()
39  {
40  }
41 
42  void clear()
43  {
44  // *** header ***
45  header.clear();
46 
47  // *** polygon ***
48  polygon.clear();
49  }
50 
51  bool readBare(yarp::os::ConnectionReader& connection) override
52  {
53  // *** header ***
54  if (!header.read(connection)) {
55  return false;
56  }
57 
58  // *** polygon ***
59  if (!polygon.read(connection)) {
60  return false;
61  }
62 
63  return !connection.isError();
64  }
65 
66  bool readBottle(yarp::os::ConnectionReader& connection) override
67  {
68  connection.convertTextMode();
69  yarp::os::idl::WireReader reader(connection);
70  if (!reader.readListHeader(2)) {
71  return false;
72  }
73 
74  // *** header ***
75  if (!header.read(connection)) {
76  return false;
77  }
78 
79  // *** polygon ***
80  if (!polygon.read(connection)) {
81  return false;
82  }
83 
84  return !connection.isError();
85  }
86 
88  bool read(yarp::os::ConnectionReader& connection) override
89  {
90  return (connection.isBareMode() ? readBare(connection)
91  : readBottle(connection));
92  }
93 
94  bool writeBare(yarp::os::ConnectionWriter& connection) const override
95  {
96  // *** header ***
97  if (!header.write(connection)) {
98  return false;
99  }
100 
101  // *** polygon ***
102  if (!polygon.write(connection)) {
103  return false;
104  }
105 
106  return !connection.isError();
107  }
108 
109  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
110  {
111  connection.appendInt32(BOTTLE_TAG_LIST);
112  connection.appendInt32(2);
113 
114  // *** header ***
115  if (!header.write(connection)) {
116  return false;
117  }
118 
119  // *** polygon ***
120  if (!polygon.write(connection)) {
121  return false;
122  }
123 
124  connection.convertTextMode();
125  return !connection.isError();
126  }
127 
129  bool write(yarp::os::ConnectionWriter& connection) const override
130  {
131  return (connection.isBareMode() ? writeBare(connection)
132  : writeBottle(connection));
133  }
134 
135  // This class will serialize ROS style or YARP style depending on protocol.
136  // If you need to force a serialization style, use one of these classes:
139 
140  // The name for this message, ROS will need this
141  static constexpr const char* typeName = "geometry_msgs/PolygonStamped";
142 
143  // The checksum for this message, ROS will need this
144  static constexpr const char* typeChecksum = "c6be8f7dc3bee7fe9e8d296070f53340";
145 
146  // The source text for this message, ROS will need this
147  static constexpr const char* typeText = "\
148 # This represents a Polygon with reference coordinate frame and timestamp\n\
149 Header header\n\
150 Polygon polygon\n\
151 \n\
152 ================================================================================\n\
153 MSG: std_msgs/Header\n\
154 # Standard metadata for higher-level stamped data types.\n\
155 # This is generally used to communicate timestamped data \n\
156 # in a particular coordinate frame.\n\
157 # \n\
158 # sequence ID: consecutively increasing ID \n\
159 uint32 seq\n\
160 #Two-integer timestamp that is expressed as:\n\
161 # * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
162 # * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
163 # time-handling sugar is provided by the client library\n\
164 time stamp\n\
165 #Frame this data is associated with\n\
166 # 0: no frame\n\
167 # 1: global frame\n\
168 string frame_id\n\
169 \n\
170 ================================================================================\n\
171 MSG: geometry_msgs/Polygon\n\
172 #A specification of a polygon where the first and last points are assumed to be connected\n\
173 Point32[] points\n\
174 \n\
175 ================================================================================\n\
176 MSG: geometry_msgs/Point32\n\
177 # This contains the position of a point in free space(with 32 bits of precision).\n\
178 # It is recommeded to use Point wherever possible instead of Point32. \n\
179 # \n\
180 # This recommendation is to promote interoperability. \n\
181 #\n\
182 # This message is designed to take up less space when sending\n\
183 # lots of points at once, as in the case of a PointCloud. \n\
184 \n\
185 float32 x\n\
186 float32 y\n\
187 float32 z\n\
188 ";
189 
190  yarp::os::Type getType() const override
191  {
193  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
194  typ.addProperty("message_definition", yarp::os::Value(typeText));
195  return typ;
196  }
197 };
198 
199 } // namespace geometry_msgs
200 } // namespace rosmsg
201 } // namespace yarp
202 
203 #endif // YARP_ROSMSG_geometry_msgs_PolygonStamped_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 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:45
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:23
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:30
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static constexpr const char * typeChecksum
yarp::rosmsg::geometry_msgs::Polygon polygon
bool readBottle(yarp::os::ConnectionReader &connection) override
yarp::os::Type getType() const override
yarp::rosmsg::std_msgs::Header header
bool writeBare(yarp::os::ConnectionWriter &connection) const override
yarp::os::idl::BareStyle< yarp::rosmsg::geometry_msgs::PolygonStamped > rosStyle
bool readBare(yarp::os::ConnectionReader &connection) override
static constexpr const char * typeName
static constexpr const char * typeText
yarp::os::idl::BottleStyle< yarp::rosmsg::geometry_msgs::PolygonStamped > bottleStyle
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Polygon.h:82
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Polygon.h:120
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