YARP
Yet Another Robot Platform
InertiaStamped.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/InertiaStamped" msg definition:
9 // Header header
10 // Inertia inertia
11 // Instances of this class can be read and written with YARP ports,
12 // using a ROS-compatible format.
13 
14 #ifndef YARP_ROSMSG_geometry_msgs_InertiaStamped_h
15 #define YARP_ROSMSG_geometry_msgs_InertiaStamped_h
16 
17 #include <yarp/os/Wire.h>
18 #include <yarp/os/Type.h>
19 #include <yarp/os/idl/WireTypes.h>
20 #include <string>
21 #include <vector>
24 
25 namespace yarp {
26 namespace rosmsg {
27 namespace geometry_msgs {
28 
30 {
31 public:
34 
36  header(),
37  inertia()
38  {
39  }
40 
41  void clear()
42  {
43  // *** header ***
44  header.clear();
45 
46  // *** inertia ***
47  inertia.clear();
48  }
49 
50  bool readBare(yarp::os::ConnectionReader& connection) override
51  {
52  // *** header ***
53  if (!header.read(connection)) {
54  return false;
55  }
56 
57  // *** inertia ***
58  if (!inertia.read(connection)) {
59  return false;
60  }
61 
62  return !connection.isError();
63  }
64 
65  bool readBottle(yarp::os::ConnectionReader& connection) override
66  {
67  connection.convertTextMode();
68  yarp::os::idl::WireReader reader(connection);
69  if (!reader.readListHeader(2)) {
70  return false;
71  }
72 
73  // *** header ***
74  if (!header.read(connection)) {
75  return false;
76  }
77 
78  // *** inertia ***
79  if (!inertia.read(connection)) {
80  return false;
81  }
82 
83  return !connection.isError();
84  }
85 
87  bool read(yarp::os::ConnectionReader& connection) override
88  {
89  return (connection.isBareMode() ? readBare(connection)
90  : readBottle(connection));
91  }
92 
93  bool writeBare(yarp::os::ConnectionWriter& connection) const override
94  {
95  // *** header ***
96  if (!header.write(connection)) {
97  return false;
98  }
99 
100  // *** inertia ***
101  if (!inertia.write(connection)) {
102  return false;
103  }
104 
105  return !connection.isError();
106  }
107 
108  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
109  {
110  connection.appendInt32(BOTTLE_TAG_LIST);
111  connection.appendInt32(2);
112 
113  // *** header ***
114  if (!header.write(connection)) {
115  return false;
116  }
117 
118  // *** inertia ***
119  if (!inertia.write(connection)) {
120  return false;
121  }
122 
123  connection.convertTextMode();
124  return !connection.isError();
125  }
126 
128  bool write(yarp::os::ConnectionWriter& connection) const override
129  {
130  return (connection.isBareMode() ? writeBare(connection)
131  : writeBottle(connection));
132  }
133 
134  // This class will serialize ROS style or YARP style depending on protocol.
135  // If you need to force a serialization style, use one of these classes:
138 
139  // The name for this message, ROS will need this
140  static constexpr const char* typeName = "geometry_msgs/InertiaStamped";
141 
142  // The checksum for this message, ROS will need this
143  static constexpr const char* typeChecksum = "ddee48caeab5a966c5e8d166654a9ac7";
144 
145  // The source text for this message, ROS will need this
146  static constexpr const char* typeText = "\
147 Header header\n\
148 Inertia inertia\n\
149 \n\
150 ================================================================================\n\
151 MSG: std_msgs/Header\n\
152 # Standard metadata for higher-level stamped data types.\n\
153 # This is generally used to communicate timestamped data \n\
154 # in a particular coordinate frame.\n\
155 # \n\
156 # sequence ID: consecutively increasing ID \n\
157 uint32 seq\n\
158 #Two-integer timestamp that is expressed as:\n\
159 # * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
160 # * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
161 # time-handling sugar is provided by the client library\n\
162 time stamp\n\
163 #Frame this data is associated with\n\
164 # 0: no frame\n\
165 # 1: global frame\n\
166 string frame_id\n\
167 \n\
168 ================================================================================\n\
169 MSG: geometry_msgs/Inertia\n\
170 # Mass [kg]\n\
171 float64 m\n\
172 \n\
173 # Center of mass [m]\n\
174 geometry_msgs/Vector3 com\n\
175 \n\
176 # Inertia Tensor [kg-m^2]\n\
177 # | ixx ixy ixz |\n\
178 # I = | ixy iyy iyz |\n\
179 # | ixz iyz izz |\n\
180 float64 ixx\n\
181 float64 ixy\n\
182 float64 ixz\n\
183 float64 iyy\n\
184 float64 iyz\n\
185 float64 izz\n\
186 \n\
187 ================================================================================\n\
188 MSG: geometry_msgs/Vector3\n\
189 # This represents a vector in free space. \n\
190 # It is only meant to represent a direction. Therefore, it does not\n\
191 # make sense to apply a translation to it (e.g., when applying a \n\
192 # generic rigid transformation to a Vector3, tf2 will only apply the\n\
193 # rotation). If you want your data to be translatable too, use the\n\
194 # geometry_msgs/Point message instead.\n\
195 \n\
196 float64 x\n\
197 float64 y\n\
198 float64 z\n\
199 ";
200 
201  yarp::os::Type getType() const override
202  {
204  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
205  typ.addProperty("message_definition", yarp::os::Value(typeText));
206  return typ;
207  }
208 };
209 
210 } // namespace geometry_msgs
211 } // namespace rosmsg
212 } // namespace yarp
213 
214 #endif // YARP_ROSMSG_geometry_msgs_InertiaStamped_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 read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static constexpr const char * typeChecksum
yarp::os::idl::BottleStyle< yarp::rosmsg::geometry_msgs::InertiaStamped > bottleStyle
yarp::rosmsg::std_msgs::Header header
static constexpr const char * typeName
bool readBottle(yarp::os::ConnectionReader &connection) override
yarp::os::Type getType() const override
yarp::rosmsg::geometry_msgs::Inertia inertia
static constexpr const char * typeText
bool readBare(yarp::os::ConnectionReader &connection) override
yarp::os::idl::BareStyle< yarp::rosmsg::geometry_msgs::InertiaStamped > rosStyle
bool writeBare(yarp::os::ConnectionWriter &connection) const override
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Inertia.h:242
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Inertia.h:162
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