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