YARP
Yet Another Robot Platform
QuaternionStamped.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/QuaternionStamped" msg definition:
12 // # This represents an orientation with reference coordinate frame and timestamp.
13 //
14 // Header header
15 // Quaternion quaternion
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_QuaternionStamped_h
20 #define YARP_ROSMSG_geometry_msgs_QuaternionStamped_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  header(),
42  quaternion()
43  {
44  }
45 
46  void clear()
47  {
48  // *** header ***
49  header.clear();
50 
51  // *** quaternion ***
52  quaternion.clear();
53  }
54 
55  bool readBare(yarp::os::ConnectionReader& connection) override
56  {
57  // *** header ***
58  if (!header.read(connection)) {
59  return false;
60  }
61 
62  // *** quaternion ***
63  if (!quaternion.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  // *** header ***
79  if (!header.read(connection)) {
80  return false;
81  }
82 
83  // *** quaternion ***
84  if (!quaternion.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  // *** header ***
101  if (!header.write(connection)) {
102  return false;
103  }
104 
105  // *** quaternion ***
106  if (!quaternion.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  // *** header ***
119  if (!header.write(connection)) {
120  return false;
121  }
122 
123  // *** quaternion ***
124  if (!quaternion.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/QuaternionStamped";
146 
147  // The checksum for this message, ROS will need this
148  static constexpr const char* typeChecksum = "e57f1e547e0e1fd13504588ffc8334e2";
149 
150  // The source text for this message, ROS will need this
151  static constexpr const char* typeText = "\
152 # This represents an orientation with reference coordinate frame and timestamp.\n\
153 \n\
154 Header header\n\
155 Quaternion quaternion\n\
156 \n\
157 ================================================================================\n\
158 MSG: std_msgs/Header\n\
159 # Standard metadata for higher-level stamped data types.\n\
160 # This is generally used to communicate timestamped data \n\
161 # in a particular coordinate frame.\n\
162 # \n\
163 # sequence ID: consecutively increasing ID \n\
164 uint32 seq\n\
165 #Two-integer timestamp that is expressed as:\n\
166 # * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
167 # * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
168 # time-handling sugar is provided by the client library\n\
169 time stamp\n\
170 #Frame this data is associated with\n\
171 # 0: no frame\n\
172 # 1: global frame\n\
173 string frame_id\n\
174 \n\
175 ================================================================================\n\
176 MSG: geometry_msgs/Quaternion\n\
177 # This represents an orientation in free space in quaternion form.\n\
178 \n\
179 float64 x\n\
180 float64 y\n\
181 float64 z\n\
182 float64 w\n\
183 ";
184 
185  yarp::os::Type getType() const override
186  {
188  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
189  typ.addProperty("message_definition", yarp::os::Value(typeText));
190  return typ;
191  }
192 };
193 
194 } // namespace geometry_msgs
195 } // namespace rosmsg
196 } // namespace yarp
197 
198 #endif // YARP_ROSMSG_geometry_msgs_QuaternionStamped_h
yarp::rosmsg::std_msgs::Header::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Header.h:115
yarp::rosmsg::geometry_msgs::QuaternionStamped::readBare
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: QuaternionStamped.h:55
yarp::rosmsg::geometry_msgs::QuaternionStamped::readBottle
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: QuaternionStamped.h:70
WireTypes.h
BOTTLE_TAG_LIST
#define BOTTLE_TAG_LIST
Definition: Bottle.h:30
yarp::rosmsg::geometry_msgs::QuaternionStamped::bottleStyle
yarp::os::idl::BottleStyle< yarp::rosmsg::geometry_msgs::QuaternionStamped > bottleStyle
Definition: QuaternionStamped.h:142
Quaternion.h
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
Header.h
yarp::os::ConnectionReader::isBareMode
virtual bool isBareMode() const =0
Check if the connection is bare mode.
yarp::rosmsg::std_msgs::Header::clear
void clear()
Definition: Header.h:58
Wire.h
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::QuaternionStamped::typeText
static constexpr const char * typeText
Definition: QuaternionStamped.h:151
yarp::rosmsg::geometry_msgs::Quaternion
Definition: Quaternion.h:35
yarp::rosmsg::geometry_msgs::QuaternionStamped::clear
void clear()
Definition: QuaternionStamped.h:46
yarp::rosmsg::geometry_msgs::QuaternionStamped::getType
yarp::os::Type getType() const override
Definition: QuaternionStamped.h:185
yarp::os::ConnectionWriter::isError
virtual bool isError() const =0
yarp::rosmsg::geometry_msgs::QuaternionStamped::QuaternionStamped
QuaternionStamped()
Definition: QuaternionStamped.h:40
yarp::os::Type::byName
static Type byName(const char *name)
Definition: Type.cpp:174
yarp::rosmsg::geometry_msgs::QuaternionStamped::writeBottle
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: QuaternionStamped.h:113
yarp::os::Type::addProperty
Type & addProperty(const char *key, const Value &val)
Definition: Type.cpp:137
Type.h
yarp::rosmsg::geometry_msgs::QuaternionStamped
Definition: QuaternionStamped.h:35
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::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::rosmsg::geometry_msgs::QuaternionStamped::typeChecksum
static constexpr const char * typeChecksum
Definition: QuaternionStamped.h:148
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::std_msgs::Header::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Header.h:162
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::rosmsg::geometry_msgs::QuaternionStamped::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: QuaternionStamped.h:92
yarp::os::idl::BareStyle
Definition: BareStyle.h:22
yarp::rosmsg::geometry_msgs::QuaternionStamped::header
yarp::rosmsg::std_msgs::Header header
Definition: QuaternionStamped.h:37
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::rosmsg::geometry_msgs::QuaternionStamped::quaternion
yarp::rosmsg::geometry_msgs::Quaternion quaternion
Definition: QuaternionStamped.h:38
yarp::os::Value
A single value (typically within a Bottle).
Definition: Value.h:47
yarp::rosmsg::geometry_msgs::QuaternionStamped::rosStyle
yarp::os::idl::BareStyle< yarp::rosmsg::geometry_msgs::QuaternionStamped > rosStyle
Definition: QuaternionStamped.h:141
yarp::rosmsg::geometry_msgs::QuaternionStamped::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: QuaternionStamped.h:133
yarp::rosmsg::std_msgs::Header
Definition: Header.h:45
yarp::rosmsg::geometry_msgs::QuaternionStamped::typeName
static constexpr const char * typeName
Definition: QuaternionStamped.h:145
yarp::os::idl::WireReader::readListHeader
bool readListHeader()
Definition: WireReader.cpp:470
yarp::rosmsg::geometry_msgs::QuaternionStamped::writeBare
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: QuaternionStamped.h:98
yarp::os::idl::WirePortable::write
virtual bool write(const yarp::os::idl::WireWriter &writer) const
Definition: WirePortable.cpp:20