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