YARP
Yet Another Robot Platform
InteractiveMarkerPose.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 "visualization_msgs/InteractiveMarkerPose" msg definition:
9 // # Time/frame info.
10 // Header header
11 //
12 // # Initial pose. Also, defines the pivot point for rotations.
13 // geometry_msgs/Pose pose
14 //
15 // # Identifying string. Must be globally unique in
16 // # the topic that this message is sent through.
17 // string name
18 // Instances of this class can be read and written with YARP ports,
19 // using a ROS-compatible format.
20 
21 #ifndef YARP_ROSMSG_visualization_msgs_InteractiveMarkerPose_h
22 #define YARP_ROSMSG_visualization_msgs_InteractiveMarkerPose_h
23 
24 #include <yarp/os/Wire.h>
25 #include <yarp/os/Type.h>
26 #include <yarp/os/idl/WireTypes.h>
27 #include <string>
28 #include <vector>
31 
32 namespace yarp {
33 namespace rosmsg {
34 namespace visualization_msgs {
35 
37 {
38 public:
41  std::string name;
42 
44  header(),
45  pose(),
46  name("")
47  {
48  }
49 
50  void clear()
51  {
52  // *** header ***
53  header.clear();
54 
55  // *** pose ***
56  pose.clear();
57 
58  // *** name ***
59  name = "";
60  }
61 
62  bool readBare(yarp::os::ConnectionReader& connection) override
63  {
64  // *** header ***
65  if (!header.read(connection)) {
66  return false;
67  }
68 
69  // *** pose ***
70  if (!pose.read(connection)) {
71  return false;
72  }
73 
74  // *** name ***
75  int len = connection.expectInt32();
76  name.resize(len);
77  if (!connection.expectBlock((char*)name.c_str(), len)) {
78  return false;
79  }
80 
81  return !connection.isError();
82  }
83 
84  bool readBottle(yarp::os::ConnectionReader& connection) override
85  {
86  connection.convertTextMode();
87  yarp::os::idl::WireReader reader(connection);
88  if (!reader.readListHeader(3)) {
89  return false;
90  }
91 
92  // *** header ***
93  if (!header.read(connection)) {
94  return false;
95  }
96 
97  // *** pose ***
98  if (!pose.read(connection)) {
99  return false;
100  }
101 
102  // *** name ***
103  if (!reader.readString(name)) {
104  return false;
105  }
106 
107  return !connection.isError();
108  }
109 
111  bool read(yarp::os::ConnectionReader& connection) override
112  {
113  return (connection.isBareMode() ? readBare(connection)
114  : readBottle(connection));
115  }
116 
117  bool writeBare(yarp::os::ConnectionWriter& connection) const override
118  {
119  // *** header ***
120  if (!header.write(connection)) {
121  return false;
122  }
123 
124  // *** pose ***
125  if (!pose.write(connection)) {
126  return false;
127  }
128 
129  // *** name ***
130  connection.appendInt32(name.length());
131  connection.appendExternalBlock((char*)name.c_str(), name.length());
132 
133  return !connection.isError();
134  }
135 
136  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
137  {
138  connection.appendInt32(BOTTLE_TAG_LIST);
139  connection.appendInt32(3);
140 
141  // *** header ***
142  if (!header.write(connection)) {
143  return false;
144  }
145 
146  // *** pose ***
147  if (!pose.write(connection)) {
148  return false;
149  }
150 
151  // *** name ***
152  connection.appendInt32(BOTTLE_TAG_STRING);
153  connection.appendInt32(name.length());
154  connection.appendExternalBlock((char*)name.c_str(), name.length());
155 
156  connection.convertTextMode();
157  return !connection.isError();
158  }
159 
161  bool write(yarp::os::ConnectionWriter& connection) const override
162  {
163  return (connection.isBareMode() ? writeBare(connection)
164  : writeBottle(connection));
165  }
166 
167  // This class will serialize ROS style or YARP style depending on protocol.
168  // If you need to force a serialization style, use one of these classes:
171 
172  // The name for this message, ROS will need this
173  static constexpr const char* typeName = "visualization_msgs/InteractiveMarkerPose";
174 
175  // The checksum for this message, ROS will need this
176  static constexpr const char* typeChecksum = "a6e6833209a196a38d798dadb02c81f8";
177 
178  // The source text for this message, ROS will need this
179  static constexpr const char* typeText = "\
180 # Time/frame info.\n\
181 Header header\n\
182 \n\
183 # Initial pose. Also, defines the pivot point for rotations.\n\
184 geometry_msgs/Pose pose\n\
185 \n\
186 # Identifying string. Must be globally unique in\n\
187 # the topic that this message is sent through.\n\
188 string name\n\
189 \n\
190 ================================================================================\n\
191 MSG: std_msgs/Header\n\
192 # Standard metadata for higher-level stamped data types.\n\
193 # This is generally used to communicate timestamped data \n\
194 # in a particular coordinate frame.\n\
195 # \n\
196 # sequence ID: consecutively increasing ID \n\
197 uint32 seq\n\
198 #Two-integer timestamp that is expressed as:\n\
199 # * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
200 # * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
201 # time-handling sugar is provided by the client library\n\
202 time stamp\n\
203 #Frame this data is associated with\n\
204 # 0: no frame\n\
205 # 1: global frame\n\
206 string frame_id\n\
207 \n\
208 ================================================================================\n\
209 MSG: geometry_msgs/Pose\n\
210 # A representation of pose in free space, composed of position and orientation. \n\
211 Point position\n\
212 Quaternion orientation\n\
213 \n\
214 ================================================================================\n\
215 MSG: geometry_msgs/Point\n\
216 # This contains the position of a point in free space\n\
217 float64 x\n\
218 float64 y\n\
219 float64 z\n\
220 \n\
221 ================================================================================\n\
222 MSG: geometry_msgs/Quaternion\n\
223 # This represents an orientation in free space in quaternion form.\n\
224 \n\
225 float64 x\n\
226 float64 y\n\
227 float64 z\n\
228 float64 w\n\
229 ";
230 
231  yarp::os::Type getType() const override
232  {
234  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
235  typ.addProperty("message_definition", yarp::os::Value(typeText));
236  return typ;
237  }
238 };
239 
240 } // namespace visualization_msgs
241 } // namespace rosmsg
242 } // namespace yarp
243 
244 #endif // YARP_ROSMSG_visualization_msgs_InteractiveMarkerPose_h
#define BOTTLE_TAG_STRING
Definition: Bottle.h:26
#define BOTTLE_TAG_LIST
Definition: Bottle.h:28
An interface for reading from a network connection.
virtual bool expectBlock(char *data, size_t len)=0
Read a block of data from the network connection.
virtual bool isBareMode() const =0
Check if the connection is bare mode.
virtual std::int32_t expectInt32()=0
Read a 32-bit integer from the network connection.
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 void appendExternalBlock(const char *data, size_t len)=0
Send a block of data to the network connection, without making a copy.
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 readString(std::string &str, bool *is_vocab=nullptr)
Definition: WireReader.cpp:382
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Pose.h:129
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Pose.h:88
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
yarp::os::idl::BottleStyle< yarp::rosmsg::visualization_msgs::InteractiveMarkerPose > bottleStyle
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
yarp::os::idl::BareStyle< yarp::rosmsg::visualization_msgs::InteractiveMarkerPose > rosStyle
bool writeBare(yarp::os::ConnectionWriter &connection) const override
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool readBare(yarp::os::ConnectionReader &connection) override
bool readBottle(yarp::os::ConnectionReader &connection) override
The main, catch-all namespace for YARP.
Definition: dirs.h:16