YARP
Yet Another Robot Platform
InteractiveMarkerFeedback.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/InteractiveMarkerFeedback" msg definition:
9 // # Time/frame info.
10 // Header header
11 //
12 // # Identifying string. Must be unique in the topic namespace.
13 // string client_id
14 //
15 // # Feedback message sent back from the GUI, e.g.
16 // # when the status of an interactive marker was modified by the user.
17 //
18 // # Specifies which interactive marker and control this message refers to
19 // string marker_name
20 // string control_name
21 //
22 // # Type of the event
23 // # KEEP_ALIVE: sent while dragging to keep up control of the marker
24 // # MENU_SELECT: a menu entry has been selected
25 // # BUTTON_CLICK: a button control has been clicked
26 // # POSE_UPDATE: the pose has been changed using one of the controls
27 // uint8 KEEP_ALIVE = 0
28 // uint8 POSE_UPDATE = 1
29 // uint8 MENU_SELECT = 2
30 // uint8 BUTTON_CLICK = 3
31 //
32 // uint8 MOUSE_DOWN = 4
33 // uint8 MOUSE_UP = 5
34 //
35 // uint8 event_type
36 //
37 // # Current pose of the marker
38 // # Note: Has to be valid for all feedback types.
39 // geometry_msgs/Pose pose
40 //
41 // # Contains the ID of the selected menu entry
42 // # Only valid for MENU_SELECT events.
43 // uint32 menu_entry_id
44 //
45 // # If event_type is BUTTON_CLICK, MOUSE_DOWN, or MOUSE_UP, mouse_point
46 // # may contain the 3 dimensional position of the event on the
47 // # control. If it does, mouse_point_valid will be true. mouse_point
48 // # will be relative to the frame listed in the header.
49 // geometry_msgs/Point mouse_point
50 // bool mouse_point_valid
51 // Instances of this class can be read and written with YARP ports,
52 // using a ROS-compatible format.
53 
54 #ifndef YARP_ROSMSG_visualization_msgs_InteractiveMarkerFeedback_h
55 #define YARP_ROSMSG_visualization_msgs_InteractiveMarkerFeedback_h
56 
57 #include <yarp/os/Wire.h>
58 #include <yarp/os/Type.h>
59 #include <yarp/os/idl/WireTypes.h>
60 #include <string>
61 #include <vector>
65 
66 namespace yarp {
67 namespace rosmsg {
68 namespace visualization_msgs {
69 
71 {
72 public:
74  std::string client_id;
75  std::string marker_name;
76  std::string control_name;
77  static const std::uint8_t KEEP_ALIVE = 0;
78  static const std::uint8_t POSE_UPDATE = 1;
79  static const std::uint8_t MENU_SELECT = 2;
80  static const std::uint8_t BUTTON_CLICK = 3;
81  static const std::uint8_t MOUSE_DOWN = 4;
82  static const std::uint8_t MOUSE_UP = 5;
83  std::uint8_t event_type;
85  std::uint32_t menu_entry_id;
88 
90  header(),
91  client_id(""),
92  marker_name(""),
93  control_name(""),
94  event_type(0),
95  pose(),
96  menu_entry_id(0),
97  mouse_point(),
98  mouse_point_valid(false)
99  {
100  }
101 
102  void clear()
103  {
104  // *** header ***
105  header.clear();
106 
107  // *** client_id ***
108  client_id = "";
109 
110  // *** marker_name ***
111  marker_name = "";
112 
113  // *** control_name ***
114  control_name = "";
115 
116  // *** KEEP_ALIVE ***
117 
118  // *** POSE_UPDATE ***
119 
120  // *** MENU_SELECT ***
121 
122  // *** BUTTON_CLICK ***
123 
124  // *** MOUSE_DOWN ***
125 
126  // *** MOUSE_UP ***
127 
128  // *** event_type ***
129  event_type = 0;
130 
131  // *** pose ***
132  pose.clear();
133 
134  // *** menu_entry_id ***
135  menu_entry_id = 0;
136 
137  // *** mouse_point ***
138  mouse_point.clear();
139 
140  // *** mouse_point_valid ***
141  mouse_point_valid = false;
142  }
143 
144  bool readBare(yarp::os::ConnectionReader& connection) override
145  {
146  // *** header ***
147  if (!header.read(connection)) {
148  return false;
149  }
150 
151  // *** client_id ***
152  int len = connection.expectInt32();
153  client_id.resize(len);
154  if (!connection.expectBlock((char*)client_id.c_str(), len)) {
155  return false;
156  }
157 
158  // *** marker_name ***
159  len = connection.expectInt32();
160  marker_name.resize(len);
161  if (!connection.expectBlock((char*)marker_name.c_str(), len)) {
162  return false;
163  }
164 
165  // *** control_name ***
166  len = connection.expectInt32();
167  control_name.resize(len);
168  if (!connection.expectBlock((char*)control_name.c_str(), len)) {
169  return false;
170  }
171 
172  // *** event_type ***
173  event_type = connection.expectInt8();
174 
175  // *** pose ***
176  if (!pose.read(connection)) {
177  return false;
178  }
179 
180  // *** menu_entry_id ***
181  menu_entry_id = connection.expectInt32();
182 
183  // *** mouse_point ***
184  if (!mouse_point.read(connection)) {
185  return false;
186  }
187 
188  // *** mouse_point_valid ***
189  if (!connection.expectBlock((char*)&mouse_point_valid, 1)) {
190  return false;
191  }
192 
193  return !connection.isError();
194  }
195 
196  bool readBottle(yarp::os::ConnectionReader& connection) override
197  {
198  connection.convertTextMode();
199  yarp::os::idl::WireReader reader(connection);
200  if (!reader.readListHeader(15)) {
201  return false;
202  }
203 
204  // *** header ***
205  if (!header.read(connection)) {
206  return false;
207  }
208 
209  // *** client_id ***
210  if (!reader.readString(client_id)) {
211  return false;
212  }
213 
214  // *** marker_name ***
215  if (!reader.readString(marker_name)) {
216  return false;
217  }
218 
219  // *** control_name ***
220  if (!reader.readString(control_name)) {
221  return false;
222  }
223 
224  // *** event_type ***
225  event_type = reader.expectInt8();
226 
227  // *** pose ***
228  if (!pose.read(connection)) {
229  return false;
230  }
231 
232  // *** menu_entry_id ***
233  menu_entry_id = reader.expectInt32();
234 
235  // *** mouse_point ***
236  if (!mouse_point.read(connection)) {
237  return false;
238  }
239 
240  // *** mouse_point_valid ***
241  mouse_point_valid = reader.expectInt8();
242 
243  return !connection.isError();
244  }
245 
247  bool read(yarp::os::ConnectionReader& connection) override
248  {
249  return (connection.isBareMode() ? readBare(connection)
250  : readBottle(connection));
251  }
252 
253  bool writeBare(yarp::os::ConnectionWriter& connection) const override
254  {
255  // *** header ***
256  if (!header.write(connection)) {
257  return false;
258  }
259 
260  // *** client_id ***
261  connection.appendInt32(client_id.length());
262  connection.appendExternalBlock((char*)client_id.c_str(), client_id.length());
263 
264  // *** marker_name ***
265  connection.appendInt32(marker_name.length());
266  connection.appendExternalBlock((char*)marker_name.c_str(), marker_name.length());
267 
268  // *** control_name ***
269  connection.appendInt32(control_name.length());
270  connection.appendExternalBlock((char*)control_name.c_str(), control_name.length());
271 
272  // *** event_type ***
273  connection.appendInt8(event_type);
274 
275  // *** pose ***
276  if (!pose.write(connection)) {
277  return false;
278  }
279 
280  // *** menu_entry_id ***
281  connection.appendInt32(menu_entry_id);
282 
283  // *** mouse_point ***
284  if (!mouse_point.write(connection)) {
285  return false;
286  }
287 
288  // *** mouse_point_valid ***
289  connection.appendBlock((char*)&mouse_point_valid, 1);
290 
291  return !connection.isError();
292  }
293 
294  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
295  {
296  connection.appendInt32(BOTTLE_TAG_LIST);
297  connection.appendInt32(15);
298 
299  // *** header ***
300  if (!header.write(connection)) {
301  return false;
302  }
303 
304  // *** client_id ***
305  connection.appendInt32(BOTTLE_TAG_STRING);
306  connection.appendInt32(client_id.length());
307  connection.appendExternalBlock((char*)client_id.c_str(), client_id.length());
308 
309  // *** marker_name ***
310  connection.appendInt32(BOTTLE_TAG_STRING);
311  connection.appendInt32(marker_name.length());
312  connection.appendExternalBlock((char*)marker_name.c_str(), marker_name.length());
313 
314  // *** control_name ***
315  connection.appendInt32(BOTTLE_TAG_STRING);
316  connection.appendInt32(control_name.length());
317  connection.appendExternalBlock((char*)control_name.c_str(), control_name.length());
318 
319  // *** event_type ***
320  connection.appendInt32(BOTTLE_TAG_INT8);
321  connection.appendInt8(event_type);
322 
323  // *** pose ***
324  if (!pose.write(connection)) {
325  return false;
326  }
327 
328  // *** menu_entry_id ***
329  connection.appendInt32(BOTTLE_TAG_INT32);
330  connection.appendInt32(menu_entry_id);
331 
332  // *** mouse_point ***
333  if (!mouse_point.write(connection)) {
334  return false;
335  }
336 
337  // *** mouse_point_valid ***
338  connection.appendInt32(BOTTLE_TAG_INT8);
339  connection.appendInt8(mouse_point_valid);
340 
341  connection.convertTextMode();
342  return !connection.isError();
343  }
344 
346  bool write(yarp::os::ConnectionWriter& connection) const override
347  {
348  return (connection.isBareMode() ? writeBare(connection)
349  : writeBottle(connection));
350  }
351 
352  // This class will serialize ROS style or YARP style depending on protocol.
353  // If you need to force a serialization style, use one of these classes:
356 
357  // The name for this message, ROS will need this
358  static constexpr const char* typeName = "visualization_msgs/InteractiveMarkerFeedback";
359 
360  // The checksum for this message, ROS will need this
361  static constexpr const char* typeChecksum = "ab0f1eee058667e28c19ff3ffc3f4b78";
362 
363  // The source text for this message, ROS will need this
364  static constexpr const char* typeText = "\
365 # Time/frame info.\n\
366 Header header\n\
367 \n\
368 # Identifying string. Must be unique in the topic namespace.\n\
369 string client_id\n\
370 \n\
371 # Feedback message sent back from the GUI, e.g.\n\
372 # when the status of an interactive marker was modified by the user.\n\
373 \n\
374 # Specifies which interactive marker and control this message refers to\n\
375 string marker_name\n\
376 string control_name\n\
377 \n\
378 # Type of the event\n\
379 # KEEP_ALIVE: sent while dragging to keep up control of the marker\n\
380 # MENU_SELECT: a menu entry has been selected\n\
381 # BUTTON_CLICK: a button control has been clicked\n\
382 # POSE_UPDATE: the pose has been changed using one of the controls\n\
383 uint8 KEEP_ALIVE = 0\n\
384 uint8 POSE_UPDATE = 1\n\
385 uint8 MENU_SELECT = 2\n\
386 uint8 BUTTON_CLICK = 3\n\
387 \n\
388 uint8 MOUSE_DOWN = 4\n\
389 uint8 MOUSE_UP = 5\n\
390 \n\
391 uint8 event_type\n\
392 \n\
393 # Current pose of the marker\n\
394 # Note: Has to be valid for all feedback types.\n\
395 geometry_msgs/Pose pose\n\
396 \n\
397 # Contains the ID of the selected menu entry\n\
398 # Only valid for MENU_SELECT events.\n\
399 uint32 menu_entry_id\n\
400 \n\
401 # If event_type is BUTTON_CLICK, MOUSE_DOWN, or MOUSE_UP, mouse_point\n\
402 # may contain the 3 dimensional position of the event on the\n\
403 # control. If it does, mouse_point_valid will be true. mouse_point\n\
404 # will be relative to the frame listed in the header.\n\
405 geometry_msgs/Point mouse_point\n\
406 bool mouse_point_valid\n\
407 \n\
408 ================================================================================\n\
409 MSG: std_msgs/Header\n\
410 # Standard metadata for higher-level stamped data types.\n\
411 # This is generally used to communicate timestamped data \n\
412 # in a particular coordinate frame.\n\
413 # \n\
414 # sequence ID: consecutively increasing ID \n\
415 uint32 seq\n\
416 #Two-integer timestamp that is expressed as:\n\
417 # * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
418 # * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
419 # time-handling sugar is provided by the client library\n\
420 time stamp\n\
421 #Frame this data is associated with\n\
422 # 0: no frame\n\
423 # 1: global frame\n\
424 string frame_id\n\
425 \n\
426 ================================================================================\n\
427 MSG: geometry_msgs/Pose\n\
428 # A representation of pose in free space, composed of position and orientation. \n\
429 Point position\n\
430 Quaternion orientation\n\
431 \n\
432 ================================================================================\n\
433 MSG: geometry_msgs/Point\n\
434 # This contains the position of a point in free space\n\
435 float64 x\n\
436 float64 y\n\
437 float64 z\n\
438 \n\
439 ================================================================================\n\
440 MSG: geometry_msgs/Quaternion\n\
441 # This represents an orientation in free space in quaternion form.\n\
442 \n\
443 float64 x\n\
444 float64 y\n\
445 float64 z\n\
446 float64 w\n\
447 ";
448 
449  yarp::os::Type getType() const override
450  {
452  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
453  typ.addProperty("message_definition", yarp::os::Value(typeText));
454  return typ;
455  }
456 };
457 
458 } // namespace visualization_msgs
459 } // namespace rosmsg
460 } // namespace yarp
461 
462 #endif // YARP_ROSMSG_visualization_msgs_InteractiveMarkerFeedback_h
#define BOTTLE_TAG_INT8
Definition: Bottle.h:19
#define BOTTLE_TAG_INT32
Definition: Bottle.h:21
#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
virtual std::int8_t expectInt8()=0
Read a 8-bit integer from the network connection.
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 appendInt8(std::int8_t data)=0
Send a representation of a 8-bit integer to the network connection.
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.
virtual void appendBlock(const char *data, size_t len)=0
Send a block of data 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
std::int8_t expectInt8()
Definition: WireReader.h:80
std::int32_t expectInt32()
Definition: WireReader.h:92
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Point.h:132
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Point.h:90
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
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool readBottle(yarp::os::ConnectionReader &connection) override
bool writeBare(yarp::os::ConnectionWriter &connection) const override
yarp::os::idl::BottleStyle< yarp::rosmsg::visualization_msgs::InteractiveMarkerFeedback > bottleStyle
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
yarp::os::idl::BareStyle< yarp::rosmsg::visualization_msgs::InteractiveMarkerFeedback > rosStyle
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool readBare(yarp::os::ConnectionReader &connection) override
The main, catch-all namespace for YARP.
Definition: dirs.h:16