YARP
Yet Another Robot Platform
Transform.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/Transform" msg definition:
12 // # This represents the transform between two coordinate frames in free space.
13 //
14 // Vector3 translation
15 // Quaternion rotation
16 // Instances of this class can be read and written with YARP ports,
17 // using a ROS-compatible format.
18 
19 #ifndef YARP_ROSMSG_geometry_msgs_Transform_h
20 #define YARP_ROSMSG_geometry_msgs_Transform_h
21 
22 #include <yarp/os/Wire.h>
23 #include <yarp/os/Type.h>
25 #include <string>
26 #include <vector>
29 
30 namespace yarp {
31 namespace rosmsg {
32 namespace geometry_msgs {
33 
35 {
36 public:
39 
41  translation(),
42  rotation()
43  {
44  }
45 
46  void clear()
47  {
48  // *** translation ***
50 
51  // *** rotation ***
52  rotation.clear();
53  }
54 
55  bool readBare(yarp::os::ConnectionReader& connection) override
56  {
57  // *** translation ***
58  if (!translation.read(connection)) {
59  return false;
60  }
61 
62  // *** rotation ***
63  if (!rotation.read(connection)) {
64  return false;
65  }
66 
67  return !connection.isError();
68  }
69 
70  bool readBottle(yarp::os::ConnectionReader& connection) override
71  {
72  connection.convertTextMode();
73  yarp::os::idl::WireReader reader(connection);
74  if (!reader.readListHeader(2)) {
75  return false;
76  }
77 
78  // *** translation ***
79  if (!translation.read(connection)) {
80  return false;
81  }
82 
83  // *** rotation ***
84  if (!rotation.read(connection)) {
85  return false;
86  }
87 
88  return !connection.isError();
89  }
90 
92  bool read(yarp::os::ConnectionReader& connection) override
93  {
94  return (connection.isBareMode() ? readBare(connection)
95  : readBottle(connection));
96  }
97 
98  bool writeBare(yarp::os::ConnectionWriter& connection) const override
99  {
100  // *** translation ***
101  if (!translation.write(connection)) {
102  return false;
103  }
104 
105  // *** rotation ***
106  if (!rotation.write(connection)) {
107  return false;
108  }
109 
110  return !connection.isError();
111  }
112 
113  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
114  {
115  connection.appendInt32(BOTTLE_TAG_LIST);
116  connection.appendInt32(2);
117 
118  // *** translation ***
119  if (!translation.write(connection)) {
120  return false;
121  }
122 
123  // *** rotation ***
124  if (!rotation.write(connection)) {
125  return false;
126  }
127 
128  connection.convertTextMode();
129  return !connection.isError();
130  }
131 
133  bool write(yarp::os::ConnectionWriter& connection) const override
134  {
135  return (connection.isBareMode() ? writeBare(connection)
136  : writeBottle(connection));
137  }
138 
139  // This class will serialize ROS style or YARP style depending on protocol.
140  // If you need to force a serialization style, use one of these classes:
143 
144  // The name for this message, ROS will need this
145  static constexpr const char* typeName = "geometry_msgs/Transform";
146 
147  // The checksum for this message, ROS will need this
148  static constexpr const char* typeChecksum = "ac9eff44abf714214112b05d54a3cf9b";
149 
150  // The source text for this message, ROS will need this
151  static constexpr const char* typeText = "\
152 # This represents the transform between two coordinate frames in free space.\n\
153 \n\
154 Vector3 translation\n\
155 Quaternion rotation\n\
156 \n\
157 ================================================================================\n\
158 MSG: geometry_msgs/Vector3\n\
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 ================================================================================\n\
170 MSG: geometry_msgs/Quaternion\n\
171 # This represents an orientation in free space in quaternion form.\n\
172 \n\
173 float64 x\n\
174 float64 y\n\
175 float64 z\n\
176 float64 w\n\
177 ";
178 
179  yarp::os::Type getType() const override
180  {
182  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
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_Transform_h
yarp::rosmsg::geometry_msgs::Transform::clear
void clear()
Definition: Transform.h:46
WireTypes.h
BOTTLE_TAG_LIST
#define BOTTLE_TAG_LIST
Definition: Bottle.h:30
Quaternion.h
yarp::rosmsg::geometry_msgs::Vector3
Definition: Vector3.h:38
yarp::rosmsg::geometry_msgs::Vector3::clear
void clear()
Definition: Vector3.h:51
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::Transform::typeChecksum
static constexpr const char * typeChecksum
Definition: Transform.h:148
yarp::os::ConnectionReader::isBareMode
virtual bool isBareMode() const =0
Check if the connection is bare mode.
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::Quaternion::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Quaternion.h:106
yarp::rosmsg::geometry_msgs::Transform::readBare
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: Transform.h:55
yarp::rosmsg::geometry_msgs::Transform::rotation
yarp::rosmsg::geometry_msgs::Quaternion rotation
Definition: Transform.h:38
yarp::rosmsg::geometry_msgs::Transform::bottleStyle
yarp::os::idl::BottleStyle< yarp::rosmsg::geometry_msgs::Transform > bottleStyle
Definition: Transform.h:142
yarp::rosmsg::geometry_msgs::Quaternion
Definition: Quaternion.h:35
yarp::rosmsg::geometry_msgs::Transform
Definition: Transform.h:35
yarp::os::ConnectionWriter::isError
virtual bool isError() const =0
yarp::rosmsg::geometry_msgs::Transform::writeBare
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: Transform.h:98
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::rosmsg::geometry_msgs::Transform::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Transform.h:133
yarp::os::ConnectionWriter
An interface for writing to a network connection.
Definition: ConnectionWriter.h:40
yarp::rosmsg::geometry_msgs::Transform::translation
yarp::rosmsg::geometry_msgs::Vector3 translation
Definition: Transform.h:37
yarp::rosmsg::geometry_msgs::Transform::typeName
static constexpr const char * typeName
Definition: Transform.h:145
yarp::rosmsg::geometry_msgs::Transform::Transform
Transform()
Definition: Transform.h:40
yarp::rosmsg::geometry_msgs::Transform::writeBottle
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: Transform.h:113
yarp::os::ConnectionReader::isError
virtual bool isError() const =0
Vector3.h
yarp::rosmsg::geometry_msgs::Quaternion::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Quaternion.h:155
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::rosmsg::geometry_msgs::Quaternion::clear
void clear()
Definition: Quaternion.h:50
yarp::rosmsg::geometry_msgs::Transform::readBottle
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: Transform.h:70
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
yarp::rosmsg::geometry_msgs::Transform::typeText
static constexpr const char * typeText
Definition: Transform.h:151
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::os::Value
A single value (typically within a Bottle).
Definition: Value.h:47
yarp::rosmsg::geometry_msgs::Transform::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Transform.h:92
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::rosmsg::geometry_msgs::Transform::getType
yarp::os::Type getType() const override
Definition: Transform.h:179
yarp::os::idl::WireReader::readListHeader
bool readListHeader()
Definition: WireReader.cpp:470
yarp::rosmsg::geometry_msgs::Transform::rosStyle
yarp::os::idl::BareStyle< yarp::rosmsg::geometry_msgs::Transform > rosStyle
Definition: Transform.h:141
yarp::os::idl::WirePortable::write
virtual bool write(const yarp::os::idl::WireWriter &writer) const
Definition: WirePortable.cpp:20