YARP
Yet Another Robot Platform
Quaternion.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/Quaternion" msg definition:
9// # This represents an orientation in free space in quaternion form.
10//
11// float64 x
12// float64 y
13// float64 z
14// float64 w
15// Instances of this class can be read and written with YARP ports,
16// using a ROS-compatible format.
17
18#ifndef YARP_ROSMSG_geometry_msgs_Quaternion_h
19#define YARP_ROSMSG_geometry_msgs_Quaternion_h
20
22#include <yarp/os/Type.h>
24#include <string>
25#include <vector>
26
27namespace yarp {
28namespace rosmsg {
29namespace geometry_msgs {
30
32{
33public:
38
40 x(0.0),
41 y(0.0),
42 z(0.0),
43 w(0.0)
44 {
45 }
46
47 void clear()
48 {
49 // *** x ***
50 x = 0.0;
51
52 // *** y ***
53 y = 0.0;
54
55 // *** z ***
56 z = 0.0;
57
58 // *** w ***
59 w = 0.0;
60 }
61
62 bool readBare(yarp::os::ConnectionReader& connection) override
63 {
64 // *** x ***
65 x = connection.expectFloat64();
66
67 // *** y ***
68 y = connection.expectFloat64();
69
70 // *** z ***
71 z = connection.expectFloat64();
72
73 // *** w ***
74 w = connection.expectFloat64();
75
76 return !connection.isError();
77 }
78
79 bool readBottle(yarp::os::ConnectionReader& connection) override
80 {
81 connection.convertTextMode();
82 yarp::os::idl::WireReader reader(connection);
83 if (!reader.readListHeader(4)) {
84 return false;
85 }
86
87 // *** x ***
88 x = reader.expectFloat64();
89
90 // *** y ***
91 y = reader.expectFloat64();
92
93 // *** z ***
94 z = reader.expectFloat64();
95
96 // *** w ***
97 w = reader.expectFloat64();
98
99 return !connection.isError();
100 }
101
103 bool read(yarp::os::ConnectionReader& connection) override
104 {
105 return (connection.isBareMode() ? readBare(connection)
106 : readBottle(connection));
107 }
108
109 bool writeBare(yarp::os::ConnectionWriter& connection) const override
110 {
111 // *** x ***
112 connection.appendFloat64(x);
113
114 // *** y ***
115 connection.appendFloat64(y);
116
117 // *** z ***
118 connection.appendFloat64(z);
119
120 // *** w ***
121 connection.appendFloat64(w);
122
123 return !connection.isError();
124 }
125
126 bool writeBottle(yarp::os::ConnectionWriter& connection) const override
127 {
128 connection.appendInt32(BOTTLE_TAG_LIST);
129 connection.appendInt32(4);
130
131 // *** x ***
133 connection.appendFloat64(x);
134
135 // *** y ***
137 connection.appendFloat64(y);
138
139 // *** z ***
141 connection.appendFloat64(z);
142
143 // *** w ***
145 connection.appendFloat64(w);
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/Quaternion";
165
166 // The checksum for this message, ROS will need this
167 static constexpr const char* typeChecksum = "a779879fadf0160734f906b8c19c7004";
168
169 // The source text for this message, ROS will need this
170 static constexpr const char* typeText = "\
171# This represents an orientation in free space in quaternion form.\n\
172\n\
173float64 x\n\
174float64 y\n\
175float64 z\n\
176float64 w\n\
177";
178
179 yarp::os::Type getType() const override
180 {
183 typ.addProperty("message_definition", yarp::os::Value(typeText));
184 return typ;
185 }
186};
187
188} // namespace geometry_msgs
189} // namespace rosmsg
190} // namespace yarp
191
192#endif // YARP_ROSMSG_geometry_msgs_Quaternion_h
#define BOTTLE_TAG_FLOAT64
Definition: Bottle.h:25
#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
virtual yarp::conf::float64_t expectFloat64()=0
Read a 64-bit floating point number from the network connection.
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.
virtual void appendFloat64(yarp::conf::float64_t data)=0
Send a representation of a 64-bit floating point number 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::conf::float64_t expectFloat64()
Definition: WireReader.h:110
yarp::os::idl::BottleStyle< yarp::rosmsg::geometry_msgs::Quaternion > bottleStyle
Definition: Quaternion.h:161
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Quaternion.h:152
yarp::os::Type getType() const override
Definition: Quaternion.h:179
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: Quaternion.h:126
static constexpr const char * typeName
Definition: Quaternion.h:164
static constexpr const char * typeChecksum
Definition: Quaternion.h:167
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: Quaternion.h:62
yarp::os::idl::BareStyle< yarp::rosmsg::geometry_msgs::Quaternion > rosStyle
Definition: Quaternion.h:160
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: Quaternion.h:109
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: Quaternion.h:79
static constexpr const char * typeText
Definition: Quaternion.h:170
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Quaternion.h:103
double float64_t
Definition: numeric.h:77
The main, catch-all namespace for YARP.
Definition: dirs.h:16