YARP
Yet Another Robot Platform
Point32.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/Point32" msg definition:
12 // # This contains the position of a point in free space(with 32 bits of precision).
13 // # It is recommeded to use Point wherever possible instead of Point32.
14 // #
15 // # This recommendation is to promote interoperability.
16 // #
17 // # This message is designed to take up less space when sending
18 // # lots of points at once, as in the case of a PointCloud.
19 //
20 // float32 x
21 // float32 y
22 // float32 z// Instances of this class can be read and written with YARP ports,
23 // using a ROS-compatible format.
24 
25 #ifndef YARP_ROSMSG_geometry_msgs_Point32_h
26 #define YARP_ROSMSG_geometry_msgs_Point32_h
27 
28 #include <yarp/os/Wire.h>
29 #include <yarp/os/Type.h>
30 #include <yarp/os/idl/WireTypes.h>
31 #include <string>
32 #include <vector>
33 
34 namespace yarp {
35 namespace rosmsg {
36 namespace geometry_msgs {
37 
39 {
40 public:
44 
45  Point32() :
46  x(0.0f),
47  y(0.0f),
48  z(0.0f)
49  {
50  }
51 
52  void clear()
53  {
54  // *** x ***
55  x = 0.0f;
56 
57  // *** y ***
58  y = 0.0f;
59 
60  // *** z ***
61  z = 0.0f;
62  }
63 
64  bool readBare(yarp::os::ConnectionReader& connection) override
65  {
66  // *** x ***
67  x = connection.expectFloat32();
68 
69  // *** y ***
70  y = connection.expectFloat32();
71 
72  // *** z ***
73  z = connection.expectFloat32();
74 
75  return !connection.isError();
76  }
77 
78  bool readBottle(yarp::os::ConnectionReader& connection) override
79  {
80  connection.convertTextMode();
81  yarp::os::idl::WireReader reader(connection);
82  if (!reader.readListHeader(3)) {
83  return false;
84  }
85 
86  // *** x ***
87  x = reader.expectFloat32();
88 
89  // *** y ***
90  y = reader.expectFloat32();
91 
92  // *** z ***
93  z = reader.expectFloat32();
94 
95  return !connection.isError();
96  }
97 
99  bool read(yarp::os::ConnectionReader& connection) override
100  {
101  return (connection.isBareMode() ? readBare(connection)
102  : readBottle(connection));
103  }
104 
105  bool writeBare(yarp::os::ConnectionWriter& connection) const override
106  {
107  // *** x ***
108  connection.appendFloat32(x);
109 
110  // *** y ***
111  connection.appendFloat32(y);
112 
113  // *** z ***
114  connection.appendFloat32(z);
115 
116  return !connection.isError();
117  }
118 
119  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
120  {
121  connection.appendInt32(BOTTLE_TAG_LIST);
122  connection.appendInt32(3);
123 
124  // *** x ***
125  connection.appendInt32(BOTTLE_TAG_FLOAT32);
126  connection.appendFloat32(x);
127 
128  // *** y ***
129  connection.appendInt32(BOTTLE_TAG_FLOAT32);
130  connection.appendFloat32(y);
131 
132  // *** z ***
133  connection.appendInt32(BOTTLE_TAG_FLOAT32);
134  connection.appendFloat32(z);
135 
136  connection.convertTextMode();
137  return !connection.isError();
138  }
139 
141  bool write(yarp::os::ConnectionWriter& connection) const override
142  {
143  return (connection.isBareMode() ? writeBare(connection)
144  : writeBottle(connection));
145  }
146 
147  // This class will serialize ROS style or YARP style depending on protocol.
148  // If you need to force a serialization style, use one of these classes:
151 
152  // The name for this message, ROS will need this
153  static constexpr const char* typeName = "geometry_msgs/Point32";
154 
155  // The checksum for this message, ROS will need this
156  static constexpr const char* typeChecksum = "cc153912f1453b708d221682bc23d9ac";
157 
158  // The source text for this message, ROS will need this
159  static constexpr const char* typeText = "\
160 # This contains the position of a point in free space(with 32 bits of precision).\n\
161 # It is recommeded to use Point wherever possible instead of Point32. \n\
162 # \n\
163 # This recommendation is to promote interoperability. \n\
164 #\n\
165 # This message is designed to take up less space when sending\n\
166 # lots of points at once, as in the case of a PointCloud. \n\
167 \n\
168 float32 x\n\
169 float32 y\n\
170 float32 z\n\
171 ";
172 
173  yarp::os::Type getType() const override
174  {
176  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
177  typ.addProperty("message_definition", yarp::os::Value(typeText));
178  return typ;
179  }
180 };
181 
182 } // namespace geometry_msgs
183 } // namespace rosmsg
184 } // namespace yarp
185 
186 #endif // YARP_ROSMSG_geometry_msgs_Point32_h
yarp::os::ConnectionWriter::appendFloat32
virtual void appendFloat32(yarp::conf::float32_t data)=0
Send a representation of a 32-bit floating point number to the network connection.
yarp::rosmsg::geometry_msgs::Point32::readBare
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: Point32.h:64
WireTypes.h
BOTTLE_TAG_LIST
#define BOTTLE_TAG_LIST
Definition: Bottle.h:30
yarp::os::idl::WireReader::expectFloat32
yarp::conf::float32_t expectFloat32()
Definition: WireReader.h:113
yarp::rosmsg::geometry_msgs::Point32::typeText
static constexpr const char * typeText
Definition: Point32.h:159
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
yarp::rosmsg::geometry_msgs::Point32::x
yarp::conf::float32_t x
Definition: Point32.h:41
yarp::os::ConnectionReader::isBareMode
virtual bool isBareMode() const =0
Check if the connection is bare mode.
Wire.h
geometry_msgs
Definition: Accel.h:22
yarp::rosmsg::geometry_msgs::Point32::writeBottle
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: Point32.h:119
yarp::rosmsg::geometry_msgs::Point32::typeChecksum
static constexpr const char * typeChecksum
Definition: Point32.h:156
yarp::rosmsg::geometry_msgs::Point32
Definition: Point32.h:39
yarp::rosmsg::geometry_msgs::Point32::clear
void clear()
Definition: Point32.h:52
yarp::rosmsg::geometry_msgs::Point32::y
yarp::conf::float32_t y
Definition: Point32.h:42
yarp::os::ConnectionWriter::isError
virtual bool isError() const =0
BOTTLE_TAG_FLOAT32
#define BOTTLE_TAG_FLOAT32
Definition: Bottle.h:26
yarp::os::Type::byName
static Type byName(const char *name)
Definition: Type.cpp:174
yarp::os::Type::addProperty
Type & addProperty(const char *key, const Value &val)
Definition: Type.cpp:137
Type.h
yarp::os::ConnectionWriter
An interface for writing to a network connection.
Definition: ConnectionWriter.h:40
yarp::rosmsg::geometry_msgs::Point32::Point32
Point32()
Definition: Point32.h:45
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::rosmsg::geometry_msgs::Point32::bottleStyle
yarp::os::idl::BottleStyle< yarp::rosmsg::geometry_msgs::Point32 > bottleStyle
Definition: Point32.h:150
yarp::rosmsg::geometry_msgs::Point32::typeName
static constexpr const char * typeName
Definition: Point32.h:153
yarp::rosmsg::geometry_msgs::Point32::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Point32.h:99
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::Point32::readBottle
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: Point32.h:78
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::conf::float32_t
float float32_t
Definition: numeric.h:50
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::Point32::rosStyle
yarp::os::idl::BareStyle< yarp::rosmsg::geometry_msgs::Point32 > rosStyle
Definition: Point32.h:149
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::os::ConnectionReader::expectFloat32
virtual yarp::conf::float32_t expectFloat32()=0
Read a 32-bit floating point number from the network connection.
yarp::rosmsg::geometry_msgs::Point32::getType
yarp::os::Type getType() const override
Definition: Point32.h:173
yarp::rosmsg::geometry_msgs::Point32::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Point32.h:141
yarp::rosmsg::geometry_msgs::Point32::writeBare
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: Point32.h:105
yarp::os::Value
A single value (typically within a Bottle).
Definition: Value.h:47
yarp::rosmsg::geometry_msgs::Point32::z
yarp::conf::float32_t z
Definition: Point32.h:43
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