YARP
Yet Another Robot Platform
QuaternionStamped.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/QuaternionStamped" msg definition:
9 // # This represents an orientation with reference coordinate frame and timestamp.
10 //
11 // Header header
12 // Quaternion quaternion
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_QuaternionStamped_h
17 #define YARP_ROSMSG_geometry_msgs_QuaternionStamped_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  header(),
39  quaternion()
40  {
41  }
42 
43  void clear()
44  {
45  // *** header ***
46  header.clear();
47 
48  // *** quaternion ***
49  quaternion.clear();
50  }
51 
52  bool readBare(yarp::os::ConnectionReader& connection) override
53  {
54  // *** header ***
55  if (!header.read(connection)) {
56  return false;
57  }
58 
59  // *** quaternion ***
60  if (!quaternion.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  // *** header ***
76  if (!header.read(connection)) {
77  return false;
78  }
79 
80  // *** quaternion ***
81  if (!quaternion.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  // *** header ***
98  if (!header.write(connection)) {
99  return false;
100  }
101 
102  // *** quaternion ***
103  if (!quaternion.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  // *** header ***
116  if (!header.write(connection)) {
117  return false;
118  }
119 
120  // *** quaternion ***
121  if (!quaternion.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/QuaternionStamped";
143 
144  // The checksum for this message, ROS will need this
145  static constexpr const char* typeChecksum = "e57f1e547e0e1fd13504588ffc8334e2";
146 
147  // The source text for this message, ROS will need this
148  static constexpr const char* typeText = "\
149 # This represents an orientation with reference coordinate frame and timestamp.\n\
150 \n\
151 Header header\n\
152 Quaternion quaternion\n\
153 \n\
154 ================================================================================\n\
155 MSG: std_msgs/Header\n\
156 # Standard metadata for higher-level stamped data types.\n\
157 # This is generally used to communicate timestamped data \n\
158 # in a particular coordinate frame.\n\
159 # \n\
160 # sequence ID: consecutively increasing ID \n\
161 uint32 seq\n\
162 #Two-integer timestamp that is expressed as:\n\
163 # * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
164 # * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
165 # time-handling sugar is provided by the client library\n\
166 time stamp\n\
167 #Frame this data is associated with\n\
168 # 0: no frame\n\
169 # 1: global frame\n\
170 string frame_id\n\
171 \n\
172 ================================================================================\n\
173 MSG: geometry_msgs/Quaternion\n\
174 # This represents an orientation in free space in quaternion form.\n\
175 \n\
176 float64 x\n\
177 float64 y\n\
178 float64 z\n\
179 float64 w\n\
180 ";
181 
182  yarp::os::Type getType() const override
183  {
185  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
186  typ.addProperty("message_definition", yarp::os::Value(typeText));
187  return typ;
188  }
189 };
190 
191 } // namespace geometry_msgs
192 } // namespace rosmsg
193 } // namespace yarp
194 
195 #endif // YARP_ROSMSG_geometry_msgs_QuaternionStamped_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
yarp::os::idl::BottleStyle< yarp::rosmsg::geometry_msgs::QuaternionStamped > bottleStyle
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
bool readBottle(yarp::os::ConnectionReader &connection) override
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool writeBare(yarp::os::ConnectionWriter &connection) const override
yarp::rosmsg::geometry_msgs::Quaternion quaternion
bool readBare(yarp::os::ConnectionReader &connection) override
yarp::os::idl::BareStyle< yarp::rosmsg::geometry_msgs::QuaternionStamped > rosStyle
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
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Header.h:159
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Header.h:112
The main, catch-all namespace for YARP.
Definition: dirs.h:16