Fawkes API  Fawkes Development Version
VisualDisplay2DInterface.cpp
1 
2 /***************************************************************************
3  * VisualDisplay2DInterface.cpp - Fawkes BlackBoard Interface - VisualDisplay2DInterface
4  *
5  * Templated created: Thu Oct 12 10:49:19 2006
6  * Copyright 2009 Tim Niemueller
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #include <interfaces/VisualDisplay2DInterface.h>
25 
26 #include <core/exceptions/software.h>
27 
28 #include <map>
29 #include <string>
30 #include <cstring>
31 #include <cstdlib>
32 
33 namespace fawkes {
34 
35 /** @class VisualDisplay2DInterface <interfaces/VisualDisplay2DInterface.h>
36  * VisualDisplay2DInterface Fawkes BlackBoard Interface.
37  *
38  This interface provides can be used by graphing applications to
39  provide a graphing service to other components. This is intended
40  to be used for debugging purposes. Usage of the interface should
41  be optional to turn it off during a competition.
42 
43  Add* messages will add the given object permanently, so the
44  graphical display can be considered as a scenegraph. The message
45  ID is becomes the ID and can be used to delete the object using
46  the DeleteObjectMessage. With the DeleteAll message all objects
47  can be removed (shall only remove objects added by the same
48  sender, thus data drawn by other senders is not touched).
49 
50  The units shall be in meters and radians. Color is given as four
51  byte RGBA value, one byte for each R, G, B and Alpha.
52 
53  * @ingroup FawkesInterfaces
54  */
55 
56 
57 
58 /** Constructor */
59 VisualDisplay2DInterface::VisualDisplay2DInterface() : Interface()
60 {
61  data_size = sizeof(VisualDisplay2DInterface_data_t);
62  data_ptr = malloc(data_size);
63  data = (VisualDisplay2DInterface_data_t *)data_ptr;
64  data_ts = (interface_data_ts_t *)data_ptr;
65  memset(data_ptr, 0, data_size);
66  enum_map_LineStyle[(int)LS_SOLID] = "LS_SOLID";
67  enum_map_LineStyle[(int)LS_DASHED] = "LS_DASHED";
68  enum_map_LineStyle[(int)LS_DOTTED] = "LS_DOTTED";
69  enum_map_LineStyle[(int)LS_DASH_DOTTED] = "LS_DASH_DOTTED";
70  enum_map_Anchor[(int)CENTERED] = "CENTERED";
71  enum_map_Anchor[(int)NORTH] = "NORTH";
72  enum_map_Anchor[(int)EAST] = "EAST";
73  enum_map_Anchor[(int)SOUTH] = "SOUTH";
74  enum_map_Anchor[(int)WEST] = "WEST";
75  enum_map_Anchor[(int)NORTH_EAST] = "NORTH_EAST";
76  enum_map_Anchor[(int)SOUTH_EAST] = "SOUTH_EAST";
77  enum_map_Anchor[(int)SOUTH_WEST] = "SOUTH_WEST";
78  enum_map_Anchor[(int)NORTH_WEST] = "NORTH_WEST";
79  add_fieldinfo(IFT_UINT32, "counter", 1, &data->counter);
80  add_messageinfo("AddCartLineMessage");
81  add_messageinfo("AddCartCircleMessage");
82  add_messageinfo("AddCartRectMessage");
83  add_messageinfo("AddCartTextMessage");
84  add_messageinfo("DeleteObjectMessage");
85  add_messageinfo("DeleteAllMessage");
86  unsigned char tmp_hash[] = {0xd9, 0x2, 0xad, 0xbb, 0x7a, 0x47, 0x40, 0x6a, 0x4f, 0x6d, 0xfa, 0xa, 0x20, 0x35, 0xe6, 0x1};
87  set_hash(tmp_hash);
88 }
89 
90 /** Destructor */
91 VisualDisplay2DInterface::~VisualDisplay2DInterface()
92 {
93  free(data_ptr);
94 }
95 /** Convert LineStyle constant to string.
96  * @param value value to convert to string
97  * @return constant value as string.
98  */
99 const char *
101 {
102  switch (value) {
103  case LS_SOLID: return "LS_SOLID";
104  case LS_DASHED: return "LS_DASHED";
105  case LS_DOTTED: return "LS_DOTTED";
106  case LS_DASH_DOTTED: return "LS_DASH_DOTTED";
107  default: return "UNKNOWN";
108  }
109 }
110 /** Convert Anchor constant to string.
111  * @param value value to convert to string
112  * @return constant value as string.
113  */
114 const char *
116 {
117  switch (value) {
118  case CENTERED: return "CENTERED";
119  case NORTH: return "NORTH";
120  case EAST: return "EAST";
121  case SOUTH: return "SOUTH";
122  case WEST: return "WEST";
123  case NORTH_EAST: return "NORTH_EAST";
124  case SOUTH_EAST: return "SOUTH_EAST";
125  case SOUTH_WEST: return "SOUTH_WEST";
126  case NORTH_WEST: return "NORTH_WEST";
127  default: return "UNKNOWN";
128  }
129 }
130 /* Methods */
131 /** Get counter value.
132  * Field
133  * @return counter value
134  */
135 uint32_t
137 {
138  return data->counter;
139 }
140 
141 /** Get maximum length of counter value.
142  * @return length of counter value, can be length of the array or number of
143  * maximum number of characters for a string
144  */
145 size_t
147 {
148  return 1;
149 }
150 
151 /** Set counter value.
152  * Field
153  * @param new_counter new counter value
154  */
155 void
156 VisualDisplay2DInterface::set_counter(const uint32_t new_counter)
157 {
158  data->counter = new_counter;
159  data_changed = true;
160 }
161 
162 /* =========== message create =========== */
163 Message *
165 {
166  if ( strncmp("AddCartLineMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
167  return new AddCartLineMessage();
168  } else if ( strncmp("AddCartCircleMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
169  return new AddCartCircleMessage();
170  } else if ( strncmp("AddCartRectMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
171  return new AddCartRectMessage();
172  } else if ( strncmp("AddCartTextMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
173  return new AddCartTextMessage();
174  } else if ( strncmp("DeleteObjectMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
175  return new DeleteObjectMessage();
176  } else if ( strncmp("DeleteAllMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
177  return new DeleteAllMessage();
178  } else {
179  throw UnknownTypeException("The given type '%s' does not match any known "
180  "message type for this interface type.", type);
181  }
182 }
183 
184 
185 /** Copy values from other interface.
186  * @param other other interface to copy values from
187  */
188 void
190 {
191  const VisualDisplay2DInterface *oi = dynamic_cast<const VisualDisplay2DInterface *>(other);
192  if (oi == NULL) {
193  throw TypeMismatchException("Can only copy values from interface of same type (%s vs. %s)",
194  type(), other->type());
195  }
196  memcpy(data, oi->data, sizeof(VisualDisplay2DInterface_data_t));
197 }
198 
199 const char *
200 VisualDisplay2DInterface::enum_tostring(const char *enumtype, int val) const
201 {
202  if (strcmp(enumtype, "LineStyle") == 0) {
203  return tostring_LineStyle((LineStyle)val);
204  }
205  if (strcmp(enumtype, "Anchor") == 0) {
206  return tostring_Anchor((Anchor)val);
207  }
208  throw UnknownTypeException("Unknown enum type %s", enumtype);
209 }
210 
211 /* =========== messages =========== */
212 /** @class VisualDisplay2DInterface::AddCartLineMessage <interfaces/VisualDisplay2DInterface.h>
213  * AddCartLineMessage Fawkes BlackBoard Interface Message.
214  *
215 
216  */
217 
218 
219 /** Constructor with initial values.
220  * @param ini_x initial value for x
221  * @param ini_y initial value for y
222  * @param ini_style initial value for style
223  * @param ini_color initial value for color
224  */
225 VisualDisplay2DInterface::AddCartLineMessage::AddCartLineMessage(const float * ini_x, const float * ini_y, const LineStyle ini_style, const uint8_t * ini_color) : Message("AddCartLineMessage")
226 {
227  data_size = sizeof(AddCartLineMessage_data_t);
228  data_ptr = malloc(data_size);
229  memset(data_ptr, 0, data_size);
230  data = (AddCartLineMessage_data_t *)data_ptr;
232  memcpy(data->x, ini_x, sizeof(float) * 2);
233  memcpy(data->y, ini_y, sizeof(float) * 2);
234  data->style = ini_style;
235  memcpy(data->color, ini_color, sizeof(uint8_t) * 4);
236  enum_map_LineStyle[(int)LS_SOLID] = "LS_SOLID";
237  enum_map_LineStyle[(int)LS_DASHED] = "LS_DASHED";
238  enum_map_LineStyle[(int)LS_DOTTED] = "LS_DOTTED";
239  enum_map_LineStyle[(int)LS_DASH_DOTTED] = "LS_DASH_DOTTED";
240  enum_map_Anchor[(int)CENTERED] = "CENTERED";
241  enum_map_Anchor[(int)NORTH] = "NORTH";
242  enum_map_Anchor[(int)EAST] = "EAST";
243  enum_map_Anchor[(int)SOUTH] = "SOUTH";
244  enum_map_Anchor[(int)WEST] = "WEST";
245  enum_map_Anchor[(int)NORTH_EAST] = "NORTH_EAST";
246  enum_map_Anchor[(int)SOUTH_EAST] = "SOUTH_EAST";
247  enum_map_Anchor[(int)SOUTH_WEST] = "SOUTH_WEST";
248  enum_map_Anchor[(int)NORTH_WEST] = "NORTH_WEST";
249  add_fieldinfo(IFT_FLOAT, "x", 2, &data->x);
250  add_fieldinfo(IFT_FLOAT, "y", 2, &data->y);
251  add_fieldinfo(IFT_ENUM, "style", 1, &data->style, "LineStyle", &enum_map_LineStyle);
252  add_fieldinfo(IFT_BYTE, "color", 4, &data->color);
253 }
254 /** Constructor */
256 {
257  data_size = sizeof(AddCartLineMessage_data_t);
258  data_ptr = malloc(data_size);
259  memset(data_ptr, 0, data_size);
260  data = (AddCartLineMessage_data_t *)data_ptr;
262  enum_map_LineStyle[(int)LS_SOLID] = "LS_SOLID";
263  enum_map_LineStyle[(int)LS_DASHED] = "LS_DASHED";
264  enum_map_LineStyle[(int)LS_DOTTED] = "LS_DOTTED";
265  enum_map_LineStyle[(int)LS_DASH_DOTTED] = "LS_DASH_DOTTED";
266  enum_map_Anchor[(int)CENTERED] = "CENTERED";
267  enum_map_Anchor[(int)NORTH] = "NORTH";
268  enum_map_Anchor[(int)EAST] = "EAST";
269  enum_map_Anchor[(int)SOUTH] = "SOUTH";
270  enum_map_Anchor[(int)WEST] = "WEST";
271  enum_map_Anchor[(int)NORTH_EAST] = "NORTH_EAST";
272  enum_map_Anchor[(int)SOUTH_EAST] = "SOUTH_EAST";
273  enum_map_Anchor[(int)SOUTH_WEST] = "SOUTH_WEST";
274  enum_map_Anchor[(int)NORTH_WEST] = "NORTH_WEST";
275  add_fieldinfo(IFT_FLOAT, "x", 2, &data->x);
276  add_fieldinfo(IFT_FLOAT, "y", 2, &data->y);
277  add_fieldinfo(IFT_ENUM, "style", 1, &data->style, "LineStyle", &enum_map_LineStyle);
278  add_fieldinfo(IFT_BYTE, "color", 4, &data->color);
279 }
280 
281 /** Destructor */
283 {
284  free(data_ptr);
285 }
286 
287 /** Copy constructor.
288  * @param m message to copy from
289  */
291 {
292  data_size = m->data_size;
293  data_ptr = malloc(data_size);
294  memcpy(data_ptr, m->data_ptr, data_size);
295  data = (AddCartLineMessage_data_t *)data_ptr;
297 }
298 
299 /* Methods */
300 /** Get x value.
301  * X coordinates of two points
302  * @return x value
303  */
304 float *
306 {
307  return data->x;
308 }
309 
310 /** Get x value at given index.
311  * X coordinates of two points
312  * @param index index of value
313  * @return x value
314  * @exception Exception thrown if index is out of bounds
315  */
316 float
318 {
319  if (index > 2) {
320  throw Exception("Index value %u out of bounds (0..2)", index);
321  }
322  return data->x[index];
323 }
324 
325 /** Get maximum length of x value.
326  * @return length of x value, can be length of the array or number of
327  * maximum number of characters for a string
328  */
329 size_t
331 {
332  return 2;
333 }
334 
335 /** Set x value.
336  * X coordinates of two points
337  * @param new_x new x value
338  */
339 void
341 {
342  memcpy(data->x, new_x, sizeof(float) * 2);
343 }
344 
345 /** Set x value at given index.
346  * X coordinates of two points
347  * @param new_x new x value
348  * @param index index for of the value
349  */
350 void
351 VisualDisplay2DInterface::AddCartLineMessage::set_x(unsigned int index, const float new_x)
352 {
353  if (index > 2) {
354  throw Exception("Index value %u out of bounds (0..2)", index);
355  }
356  data->x[index] = new_x;
357 }
358 /** Get y value.
359  * Y coordinates of two
360  points
361  * @return y value
362  */
363 float *
365 {
366  return data->y;
367 }
368 
369 /** Get y value at given index.
370  * Y coordinates of two
371  points
372  * @param index index of value
373  * @return y value
374  * @exception Exception thrown if index is out of bounds
375  */
376 float
378 {
379  if (index > 2) {
380  throw Exception("Index value %u out of bounds (0..2)", index);
381  }
382  return data->y[index];
383 }
384 
385 /** Get maximum length of y value.
386  * @return length of y value, can be length of the array or number of
387  * maximum number of characters for a string
388  */
389 size_t
391 {
392  return 2;
393 }
394 
395 /** Set y value.
396  * Y coordinates of two
397  points
398  * @param new_y new y value
399  */
400 void
402 {
403  memcpy(data->y, new_y, sizeof(float) * 2);
404 }
405 
406 /** Set y value at given index.
407  * Y coordinates of two
408  points
409  * @param new_y new y value
410  * @param index index for of the value
411  */
412 void
413 VisualDisplay2DInterface::AddCartLineMessage::set_y(unsigned int index, const float new_y)
414 {
415  if (index > 2) {
416  throw Exception("Index value %u out of bounds (0..2)", index);
417  }
418  data->y[index] = new_y;
419 }
420 /** Get style value.
421  * Style of this object.
422  * @return style value
423  */
426 {
427  return (VisualDisplay2DInterface::LineStyle)data->style;
428 }
429 
430 /** Get maximum length of style value.
431  * @return length of style value, can be length of the array or number of
432  * maximum number of characters for a string
433  */
434 size_t
436 {
437  return 1;
438 }
439 
440 /** Set style value.
441  * Style of this object.
442  * @param new_style new style value
443  */
444 void
446 {
447  data->style = new_style;
448 }
449 
450 /** Get color value.
451  * Color in RGBA
452  * @return color value
453  */
454 uint8_t *
456 {
457  return data->color;
458 }
459 
460 /** Get color value at given index.
461  * Color in RGBA
462  * @param index index of value
463  * @return color value
464  * @exception Exception thrown if index is out of bounds
465  */
466 uint8_t
468 {
469  if (index > 4) {
470  throw Exception("Index value %u out of bounds (0..4)", index);
471  }
472  return data->color[index];
473 }
474 
475 /** Get maximum length of color value.
476  * @return length of color value, can be length of the array or number of
477  * maximum number of characters for a string
478  */
479 size_t
481 {
482  return 4;
483 }
484 
485 /** Set color value.
486  * Color in RGBA
487  * @param new_color new color value
488  */
489 void
491 {
492  memcpy(data->color, new_color, sizeof(uint8_t) * 4);
493 }
494 
495 /** Set color value at given index.
496  * Color in RGBA
497  * @param new_color new color value
498  * @param index index for of the value
499  */
500 void
501 VisualDisplay2DInterface::AddCartLineMessage::set_color(unsigned int index, const uint8_t new_color)
502 {
503  if (index > 4) {
504  throw Exception("Index value %u out of bounds (0..4)", index);
505  }
506  data->color[index] = new_color;
507 }
508 /** Clone this message.
509  * Produces a message of the same type as this message and copies the
510  * data to the new message.
511  * @return clone of this message
512  */
513 Message *
515 {
517 }
518 /** @class VisualDisplay2DInterface::AddCartCircleMessage <interfaces/VisualDisplay2DInterface.h>
519  * AddCartCircleMessage Fawkes BlackBoard Interface Message.
520  *
521 
522  */
523 
524 
525 /** Constructor with initial values.
526  * @param ini_x initial value for x
527  * @param ini_y initial value for y
528  * @param ini_radius initial value for radius
529  * @param ini_style initial value for style
530  * @param ini_color initial value for color
531  */
532 VisualDisplay2DInterface::AddCartCircleMessage::AddCartCircleMessage(const float ini_x, const float ini_y, const float ini_radius, const LineStyle ini_style, const uint8_t * ini_color) : Message("AddCartCircleMessage")
533 {
534  data_size = sizeof(AddCartCircleMessage_data_t);
535  data_ptr = malloc(data_size);
536  memset(data_ptr, 0, data_size);
537  data = (AddCartCircleMessage_data_t *)data_ptr;
539  data->x = ini_x;
540  data->y = ini_y;
541  data->radius = ini_radius;
542  data->style = ini_style;
543  memcpy(data->color, ini_color, sizeof(uint8_t) * 4);
544  enum_map_LineStyle[(int)LS_SOLID] = "LS_SOLID";
545  enum_map_LineStyle[(int)LS_DASHED] = "LS_DASHED";
546  enum_map_LineStyle[(int)LS_DOTTED] = "LS_DOTTED";
547  enum_map_LineStyle[(int)LS_DASH_DOTTED] = "LS_DASH_DOTTED";
548  enum_map_Anchor[(int)CENTERED] = "CENTERED";
549  enum_map_Anchor[(int)NORTH] = "NORTH";
550  enum_map_Anchor[(int)EAST] = "EAST";
551  enum_map_Anchor[(int)SOUTH] = "SOUTH";
552  enum_map_Anchor[(int)WEST] = "WEST";
553  enum_map_Anchor[(int)NORTH_EAST] = "NORTH_EAST";
554  enum_map_Anchor[(int)SOUTH_EAST] = "SOUTH_EAST";
555  enum_map_Anchor[(int)SOUTH_WEST] = "SOUTH_WEST";
556  enum_map_Anchor[(int)NORTH_WEST] = "NORTH_WEST";
557  add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
558  add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
559  add_fieldinfo(IFT_FLOAT, "radius", 1, &data->radius);
560  add_fieldinfo(IFT_ENUM, "style", 1, &data->style, "LineStyle", &enum_map_LineStyle);
561  add_fieldinfo(IFT_BYTE, "color", 4, &data->color);
562 }
563 /** Constructor */
565 {
566  data_size = sizeof(AddCartCircleMessage_data_t);
567  data_ptr = malloc(data_size);
568  memset(data_ptr, 0, data_size);
569  data = (AddCartCircleMessage_data_t *)data_ptr;
571  enum_map_LineStyle[(int)LS_SOLID] = "LS_SOLID";
572  enum_map_LineStyle[(int)LS_DASHED] = "LS_DASHED";
573  enum_map_LineStyle[(int)LS_DOTTED] = "LS_DOTTED";
574  enum_map_LineStyle[(int)LS_DASH_DOTTED] = "LS_DASH_DOTTED";
575  enum_map_Anchor[(int)CENTERED] = "CENTERED";
576  enum_map_Anchor[(int)NORTH] = "NORTH";
577  enum_map_Anchor[(int)EAST] = "EAST";
578  enum_map_Anchor[(int)SOUTH] = "SOUTH";
579  enum_map_Anchor[(int)WEST] = "WEST";
580  enum_map_Anchor[(int)NORTH_EAST] = "NORTH_EAST";
581  enum_map_Anchor[(int)SOUTH_EAST] = "SOUTH_EAST";
582  enum_map_Anchor[(int)SOUTH_WEST] = "SOUTH_WEST";
583  enum_map_Anchor[(int)NORTH_WEST] = "NORTH_WEST";
584  add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
585  add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
586  add_fieldinfo(IFT_FLOAT, "radius", 1, &data->radius);
587  add_fieldinfo(IFT_ENUM, "style", 1, &data->style, "LineStyle", &enum_map_LineStyle);
588  add_fieldinfo(IFT_BYTE, "color", 4, &data->color);
589 }
590 
591 /** Destructor */
593 {
594  free(data_ptr);
595 }
596 
597 /** Copy constructor.
598  * @param m message to copy from
599  */
601 {
602  data_size = m->data_size;
603  data_ptr = malloc(data_size);
604  memcpy(data_ptr, m->data_ptr, data_size);
605  data = (AddCartCircleMessage_data_t *)data_ptr;
607 }
608 
609 /* Methods */
610 /** Get x value.
611  * X coordinate of center point
612  * @return x value
613  */
614 float
616 {
617  return data->x;
618 }
619 
620 /** Get maximum length of x value.
621  * @return length of x value, can be length of the array or number of
622  * maximum number of characters for a string
623  */
624 size_t
626 {
627  return 1;
628 }
629 
630 /** Set x value.
631  * X coordinate of center point
632  * @param new_x new x value
633  */
634 void
636 {
637  data->x = new_x;
638 }
639 
640 /** Get y value.
641  * Y coordinate of center point
642  * @return y value
643  */
644 float
646 {
647  return data->y;
648 }
649 
650 /** Get maximum length of y value.
651  * @return length of y value, can be length of the array or number of
652  * maximum number of characters for a string
653  */
654 size_t
656 {
657  return 1;
658 }
659 
660 /** Set y value.
661  * Y coordinate of center point
662  * @param new_y new y value
663  */
664 void
666 {
667  data->y = new_y;
668 }
669 
670 /** Get radius value.
671  * Radius of the circle.
672  * @return radius value
673  */
674 float
676 {
677  return data->radius;
678 }
679 
680 /** Get maximum length of radius value.
681  * @return length of radius value, can be length of the array or number of
682  * maximum number of characters for a string
683  */
684 size_t
686 {
687  return 1;
688 }
689 
690 /** Set radius value.
691  * Radius of the circle.
692  * @param new_radius new radius value
693  */
694 void
696 {
697  data->radius = new_radius;
698 }
699 
700 /** Get style value.
701  * Style of this object.
702  * @return style value
703  */
706 {
707  return (VisualDisplay2DInterface::LineStyle)data->style;
708 }
709 
710 /** Get maximum length of style value.
711  * @return length of style value, can be length of the array or number of
712  * maximum number of characters for a string
713  */
714 size_t
716 {
717  return 1;
718 }
719 
720 /** Set style value.
721  * Style of this object.
722  * @param new_style new style value
723  */
724 void
726 {
727  data->style = new_style;
728 }
729 
730 /** Get color value.
731  * Color in RGBA
732  * @return color value
733  */
734 uint8_t *
736 {
737  return data->color;
738 }
739 
740 /** Get color value at given index.
741  * Color in RGBA
742  * @param index index of value
743  * @return color value
744  * @exception Exception thrown if index is out of bounds
745  */
746 uint8_t
748 {
749  if (index > 4) {
750  throw Exception("Index value %u out of bounds (0..4)", index);
751  }
752  return data->color[index];
753 }
754 
755 /** Get maximum length of color value.
756  * @return length of color value, can be length of the array or number of
757  * maximum number of characters for a string
758  */
759 size_t
761 {
762  return 4;
763 }
764 
765 /** Set color value.
766  * Color in RGBA
767  * @param new_color new color value
768  */
769 void
771 {
772  memcpy(data->color, new_color, sizeof(uint8_t) * 4);
773 }
774 
775 /** Set color value at given index.
776  * Color in RGBA
777  * @param new_color new color value
778  * @param index index for of the value
779  */
780 void
781 VisualDisplay2DInterface::AddCartCircleMessage::set_color(unsigned int index, const uint8_t new_color)
782 {
783  if (index > 4) {
784  throw Exception("Index value %u out of bounds (0..4)", index);
785  }
786  data->color[index] = new_color;
787 }
788 /** Clone this message.
789  * Produces a message of the same type as this message and copies the
790  * data to the new message.
791  * @return clone of this message
792  */
793 Message *
795 {
797 }
798 /** @class VisualDisplay2DInterface::AddCartRectMessage <interfaces/VisualDisplay2DInterface.h>
799  * AddCartRectMessage Fawkes BlackBoard Interface Message.
800  *
801 
802  */
803 
804 
805 /** Constructor with initial values.
806  * @param ini_x initial value for x
807  * @param ini_y initial value for y
808  * @param ini_width initial value for width
809  * @param ini_height initial value for height
810  * @param ini_style initial value for style
811  * @param ini_color initial value for color
812  */
813 VisualDisplay2DInterface::AddCartRectMessage::AddCartRectMessage(const float ini_x, const float ini_y, const float ini_width, const float ini_height, const LineStyle ini_style, const uint8_t * ini_color) : Message("AddCartRectMessage")
814 {
815  data_size = sizeof(AddCartRectMessage_data_t);
816  data_ptr = malloc(data_size);
817  memset(data_ptr, 0, data_size);
818  data = (AddCartRectMessage_data_t *)data_ptr;
820  data->x = ini_x;
821  data->y = ini_y;
822  data->width = ini_width;
823  data->height = ini_height;
824  data->style = ini_style;
825  memcpy(data->color, ini_color, sizeof(uint8_t) * 4);
826  enum_map_LineStyle[(int)LS_SOLID] = "LS_SOLID";
827  enum_map_LineStyle[(int)LS_DASHED] = "LS_DASHED";
828  enum_map_LineStyle[(int)LS_DOTTED] = "LS_DOTTED";
829  enum_map_LineStyle[(int)LS_DASH_DOTTED] = "LS_DASH_DOTTED";
830  enum_map_Anchor[(int)CENTERED] = "CENTERED";
831  enum_map_Anchor[(int)NORTH] = "NORTH";
832  enum_map_Anchor[(int)EAST] = "EAST";
833  enum_map_Anchor[(int)SOUTH] = "SOUTH";
834  enum_map_Anchor[(int)WEST] = "WEST";
835  enum_map_Anchor[(int)NORTH_EAST] = "NORTH_EAST";
836  enum_map_Anchor[(int)SOUTH_EAST] = "SOUTH_EAST";
837  enum_map_Anchor[(int)SOUTH_WEST] = "SOUTH_WEST";
838  enum_map_Anchor[(int)NORTH_WEST] = "NORTH_WEST";
839  add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
840  add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
841  add_fieldinfo(IFT_FLOAT, "width", 1, &data->width);
842  add_fieldinfo(IFT_FLOAT, "height", 1, &data->height);
843  add_fieldinfo(IFT_ENUM, "style", 1, &data->style, "LineStyle", &enum_map_LineStyle);
844  add_fieldinfo(IFT_BYTE, "color", 4, &data->color);
845 }
846 /** Constructor */
848 {
849  data_size = sizeof(AddCartRectMessage_data_t);
850  data_ptr = malloc(data_size);
851  memset(data_ptr, 0, data_size);
852  data = (AddCartRectMessage_data_t *)data_ptr;
854  enum_map_LineStyle[(int)LS_SOLID] = "LS_SOLID";
855  enum_map_LineStyle[(int)LS_DASHED] = "LS_DASHED";
856  enum_map_LineStyle[(int)LS_DOTTED] = "LS_DOTTED";
857  enum_map_LineStyle[(int)LS_DASH_DOTTED] = "LS_DASH_DOTTED";
858  enum_map_Anchor[(int)CENTERED] = "CENTERED";
859  enum_map_Anchor[(int)NORTH] = "NORTH";
860  enum_map_Anchor[(int)EAST] = "EAST";
861  enum_map_Anchor[(int)SOUTH] = "SOUTH";
862  enum_map_Anchor[(int)WEST] = "WEST";
863  enum_map_Anchor[(int)NORTH_EAST] = "NORTH_EAST";
864  enum_map_Anchor[(int)SOUTH_EAST] = "SOUTH_EAST";
865  enum_map_Anchor[(int)SOUTH_WEST] = "SOUTH_WEST";
866  enum_map_Anchor[(int)NORTH_WEST] = "NORTH_WEST";
867  add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
868  add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
869  add_fieldinfo(IFT_FLOAT, "width", 1, &data->width);
870  add_fieldinfo(IFT_FLOAT, "height", 1, &data->height);
871  add_fieldinfo(IFT_ENUM, "style", 1, &data->style, "LineStyle", &enum_map_LineStyle);
872  add_fieldinfo(IFT_BYTE, "color", 4, &data->color);
873 }
874 
875 /** Destructor */
877 {
878  free(data_ptr);
879 }
880 
881 /** Copy constructor.
882  * @param m message to copy from
883  */
885 {
886  data_size = m->data_size;
887  data_ptr = malloc(data_size);
888  memcpy(data_ptr, m->data_ptr, data_size);
889  data = (AddCartRectMessage_data_t *)data_ptr;
891 }
892 
893 /* Methods */
894 /** Get x value.
895  * X coordinate of lower right corner
896  * @return x value
897  */
898 float
900 {
901  return data->x;
902 }
903 
904 /** Get maximum length of x value.
905  * @return length of x value, can be length of the array or number of
906  * maximum number of characters for a string
907  */
908 size_t
910 {
911  return 1;
912 }
913 
914 /** Set x value.
915  * X coordinate of lower right corner
916  * @param new_x new x value
917  */
918 void
920 {
921  data->x = new_x;
922 }
923 
924 /** Get y value.
925  * Y coordinate of lower right corner
926  * @return y value
927  */
928 float
930 {
931  return data->y;
932 }
933 
934 /** Get maximum length of y value.
935  * @return length of y value, can be length of the array or number of
936  * maximum number of characters for a string
937  */
938 size_t
940 {
941  return 1;
942 }
943 
944 /** Set y value.
945  * Y coordinate of lower right corner
946  * @param new_y new y value
947  */
948 void
950 {
951  data->y = new_y;
952 }
953 
954 /** Get width value.
955  * Width of rectangle
956  * @return width value
957  */
958 float
960 {
961  return data->width;
962 }
963 
964 /** Get maximum length of width value.
965  * @return length of width value, can be length of the array or number of
966  * maximum number of characters for a string
967  */
968 size_t
970 {
971  return 1;
972 }
973 
974 /** Set width value.
975  * Width of rectangle
976  * @param new_width new width value
977  */
978 void
980 {
981  data->width = new_width;
982 }
983 
984 /** Get height value.
985  * Height of rectangle
986  * @return height value
987  */
988 float
990 {
991  return data->height;
992 }
993 
994 /** Get maximum length of height value.
995  * @return length of height value, can be length of the array or number of
996  * maximum number of characters for a string
997  */
998 size_t
1000 {
1001  return 1;
1002 }
1003 
1004 /** Set height value.
1005  * Height of rectangle
1006  * @param new_height new height value
1007  */
1008 void
1010 {
1011  data->height = new_height;
1012 }
1013 
1014 /** Get style value.
1015  * Style of this object.
1016  * @return style value
1017  */
1020 {
1021  return (VisualDisplay2DInterface::LineStyle)data->style;
1022 }
1023 
1024 /** Get maximum length of style value.
1025  * @return length of style value, can be length of the array or number of
1026  * maximum number of characters for a string
1027  */
1028 size_t
1030 {
1031  return 1;
1032 }
1033 
1034 /** Set style value.
1035  * Style of this object.
1036  * @param new_style new style value
1037  */
1038 void
1040 {
1041  data->style = new_style;
1042 }
1043 
1044 /** Get color value.
1045  * Color in RGBA
1046  * @return color value
1047  */
1048 uint8_t *
1050 {
1051  return data->color;
1052 }
1053 
1054 /** Get color value at given index.
1055  * Color in RGBA
1056  * @param index index of value
1057  * @return color value
1058  * @exception Exception thrown if index is out of bounds
1059  */
1060 uint8_t
1062 {
1063  if (index > 4) {
1064  throw Exception("Index value %u out of bounds (0..4)", index);
1065  }
1066  return data->color[index];
1067 }
1068 
1069 /** Get maximum length of color value.
1070  * @return length of color value, can be length of the array or number of
1071  * maximum number of characters for a string
1072  */
1073 size_t
1075 {
1076  return 4;
1077 }
1078 
1079 /** Set color value.
1080  * Color in RGBA
1081  * @param new_color new color value
1082  */
1083 void
1085 {
1086  memcpy(data->color, new_color, sizeof(uint8_t) * 4);
1087 }
1088 
1089 /** Set color value at given index.
1090  * Color in RGBA
1091  * @param new_color new color value
1092  * @param index index for of the value
1093  */
1094 void
1095 VisualDisplay2DInterface::AddCartRectMessage::set_color(unsigned int index, const uint8_t new_color)
1096 {
1097  if (index > 4) {
1098  throw Exception("Index value %u out of bounds (0..4)", index);
1099  }
1100  data->color[index] = new_color;
1101 }
1102 /** Clone this message.
1103  * Produces a message of the same type as this message and copies the
1104  * data to the new message.
1105  * @return clone of this message
1106  */
1107 Message *
1109 {
1111 }
1112 /** @class VisualDisplay2DInterface::AddCartTextMessage <interfaces/VisualDisplay2DInterface.h>
1113  * AddCartTextMessage Fawkes BlackBoard Interface Message.
1114  *
1115 
1116  */
1117 
1118 
1119 /** Constructor with initial values.
1120  * @param ini_x initial value for x
1121  * @param ini_y initial value for y
1122  * @param ini_text initial value for text
1123  * @param ini_anchor initial value for anchor
1124  * @param ini_size initial value for size
1125  * @param ini_color initial value for color
1126  */
1127 VisualDisplay2DInterface::AddCartTextMessage::AddCartTextMessage(const float ini_x, const float ini_y, const char * ini_text, const Anchor ini_anchor, const float ini_size, const uint8_t * ini_color) : Message("AddCartTextMessage")
1128 {
1129  data_size = sizeof(AddCartTextMessage_data_t);
1130  data_ptr = malloc(data_size);
1131  memset(data_ptr, 0, data_size);
1132  data = (AddCartTextMessage_data_t *)data_ptr;
1134  data->x = ini_x;
1135  data->y = ini_y;
1136  strncpy(data->text, ini_text, 128);
1137  data->anchor = ini_anchor;
1138  data->size = ini_size;
1139  memcpy(data->color, ini_color, sizeof(uint8_t) * 4);
1140  enum_map_LineStyle[(int)LS_SOLID] = "LS_SOLID";
1141  enum_map_LineStyle[(int)LS_DASHED] = "LS_DASHED";
1142  enum_map_LineStyle[(int)LS_DOTTED] = "LS_DOTTED";
1143  enum_map_LineStyle[(int)LS_DASH_DOTTED] = "LS_DASH_DOTTED";
1144  enum_map_Anchor[(int)CENTERED] = "CENTERED";
1145  enum_map_Anchor[(int)NORTH] = "NORTH";
1146  enum_map_Anchor[(int)EAST] = "EAST";
1147  enum_map_Anchor[(int)SOUTH] = "SOUTH";
1148  enum_map_Anchor[(int)WEST] = "WEST";
1149  enum_map_Anchor[(int)NORTH_EAST] = "NORTH_EAST";
1150  enum_map_Anchor[(int)SOUTH_EAST] = "SOUTH_EAST";
1151  enum_map_Anchor[(int)SOUTH_WEST] = "SOUTH_WEST";
1152  enum_map_Anchor[(int)NORTH_WEST] = "NORTH_WEST";
1153  add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
1154  add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
1155  add_fieldinfo(IFT_STRING, "text", 128, data->text);
1156  add_fieldinfo(IFT_ENUM, "anchor", 1, &data->anchor, "Anchor", &enum_map_Anchor);
1157  add_fieldinfo(IFT_FLOAT, "size", 1, &data->size);
1158  add_fieldinfo(IFT_BYTE, "color", 4, &data->color);
1159 }
1160 /** Constructor */
1162 {
1163  data_size = sizeof(AddCartTextMessage_data_t);
1164  data_ptr = malloc(data_size);
1165  memset(data_ptr, 0, data_size);
1166  data = (AddCartTextMessage_data_t *)data_ptr;
1168  enum_map_LineStyle[(int)LS_SOLID] = "LS_SOLID";
1169  enum_map_LineStyle[(int)LS_DASHED] = "LS_DASHED";
1170  enum_map_LineStyle[(int)LS_DOTTED] = "LS_DOTTED";
1171  enum_map_LineStyle[(int)LS_DASH_DOTTED] = "LS_DASH_DOTTED";
1172  enum_map_Anchor[(int)CENTERED] = "CENTERED";
1173  enum_map_Anchor[(int)NORTH] = "NORTH";
1174  enum_map_Anchor[(int)EAST] = "EAST";
1175  enum_map_Anchor[(int)SOUTH] = "SOUTH";
1176  enum_map_Anchor[(int)WEST] = "WEST";
1177  enum_map_Anchor[(int)NORTH_EAST] = "NORTH_EAST";
1178  enum_map_Anchor[(int)SOUTH_EAST] = "SOUTH_EAST";
1179  enum_map_Anchor[(int)SOUTH_WEST] = "SOUTH_WEST";
1180  enum_map_Anchor[(int)NORTH_WEST] = "NORTH_WEST";
1181  add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
1182  add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
1183  add_fieldinfo(IFT_STRING, "text", 128, data->text);
1184  add_fieldinfo(IFT_ENUM, "anchor", 1, &data->anchor, "Anchor", &enum_map_Anchor);
1185  add_fieldinfo(IFT_FLOAT, "size", 1, &data->size);
1186  add_fieldinfo(IFT_BYTE, "color", 4, &data->color);
1187 }
1188 
1189 /** Destructor */
1191 {
1192  free(data_ptr);
1193 }
1194 
1195 /** Copy constructor.
1196  * @param m message to copy from
1197  */
1199 {
1200  data_size = m->data_size;
1201  data_ptr = malloc(data_size);
1202  memcpy(data_ptr, m->data_ptr, data_size);
1203  data = (AddCartTextMessage_data_t *)data_ptr;
1205 }
1206 
1207 /* Methods */
1208 /** Get x value.
1209  * X coordinate of upper left corner
1210  * @return x value
1211  */
1212 float
1214 {
1215  return data->x;
1216 }
1217 
1218 /** Get maximum length of x value.
1219  * @return length of x value, can be length of the array or number of
1220  * maximum number of characters for a string
1221  */
1222 size_t
1224 {
1225  return 1;
1226 }
1227 
1228 /** Set x value.
1229  * X coordinate of upper left corner
1230  * @param new_x new x value
1231  */
1232 void
1234 {
1235  data->x = new_x;
1236 }
1237 
1238 /** Get y value.
1239  * Y coordinate of upper left corner
1240  * @return y value
1241  */
1242 float
1244 {
1245  return data->y;
1246 }
1247 
1248 /** Get maximum length of y value.
1249  * @return length of y value, can be length of the array or number of
1250  * maximum number of characters for a string
1251  */
1252 size_t
1254 {
1255  return 1;
1256 }
1257 
1258 /** Set y value.
1259  * Y coordinate of upper left corner
1260  * @param new_y new y value
1261  */
1262 void
1264 {
1265  data->y = new_y;
1266 }
1267 
1268 /** Get text value.
1269  * Width of rectangle
1270  * @return text value
1271  */
1272 char *
1274 {
1275  return data->text;
1276 }
1277 
1278 /** Get maximum length of text value.
1279  * @return length of text value, can be length of the array or number of
1280  * maximum number of characters for a string
1281  */
1282 size_t
1284 {
1285  return 128;
1286 }
1287 
1288 /** Set text value.
1289  * Width of rectangle
1290  * @param new_text new text value
1291  */
1292 void
1294 {
1295  strncpy(data->text, new_text, sizeof(data->text));
1296 }
1297 
1298 /** Get anchor value.
1299  * Anchor which marks the
1300  alignment to the given point.
1301  * @return anchor value
1302  */
1305 {
1306  return (VisualDisplay2DInterface::Anchor)data->anchor;
1307 }
1308 
1309 /** Get maximum length of anchor value.
1310  * @return length of anchor value, can be length of the array or number of
1311  * maximum number of characters for a string
1312  */
1313 size_t
1315 {
1316  return 1;
1317 }
1318 
1319 /** Set anchor value.
1320  * Anchor which marks the
1321  alignment to the given point.
1322  * @param new_anchor new anchor value
1323  */
1324 void
1326 {
1327  data->anchor = new_anchor;
1328 }
1329 
1330 /** Get size value.
1331  * Font size (max height in m).
1332  * @return size value
1333  */
1334 float
1336 {
1337  return data->size;
1338 }
1339 
1340 /** Get maximum length of size value.
1341  * @return length of size value, can be length of the array or number of
1342  * maximum number of characters for a string
1343  */
1344 size_t
1346 {
1347  return 1;
1348 }
1349 
1350 /** Set size value.
1351  * Font size (max height in m).
1352  * @param new_size new size value
1353  */
1354 void
1356 {
1357  data->size = new_size;
1358 }
1359 
1360 /** Get color value.
1361  * Color in RGBA
1362  * @return color value
1363  */
1364 uint8_t *
1366 {
1367  return data->color;
1368 }
1369 
1370 /** Get color value at given index.
1371  * Color in RGBA
1372  * @param index index of value
1373  * @return color value
1374  * @exception Exception thrown if index is out of bounds
1375  */
1376 uint8_t
1378 {
1379  if (index > 4) {
1380  throw Exception("Index value %u out of bounds (0..4)", index);
1381  }
1382  return data->color[index];
1383 }
1384 
1385 /** Get maximum length of color value.
1386  * @return length of color value, can be length of the array or number of
1387  * maximum number of characters for a string
1388  */
1389 size_t
1391 {
1392  return 4;
1393 }
1394 
1395 /** Set color value.
1396  * Color in RGBA
1397  * @param new_color new color value
1398  */
1399 void
1401 {
1402  memcpy(data->color, new_color, sizeof(uint8_t) * 4);
1403 }
1404 
1405 /** Set color value at given index.
1406  * Color in RGBA
1407  * @param new_color new color value
1408  * @param index index for of the value
1409  */
1410 void
1411 VisualDisplay2DInterface::AddCartTextMessage::set_color(unsigned int index, const uint8_t new_color)
1412 {
1413  if (index > 4) {
1414  throw Exception("Index value %u out of bounds (0..4)", index);
1415  }
1416  data->color[index] = new_color;
1417 }
1418 /** Clone this message.
1419  * Produces a message of the same type as this message and copies the
1420  * data to the new message.
1421  * @return clone of this message
1422  */
1423 Message *
1425 {
1427 }
1428 /** @class VisualDisplay2DInterface::DeleteObjectMessage <interfaces/VisualDisplay2DInterface.h>
1429  * DeleteObjectMessage Fawkes BlackBoard Interface Message.
1430  *
1431 
1432  */
1433 
1434 
1435 /** Constructor with initial values.
1436  * @param ini_object_id initial value for object_id
1437  */
1438 VisualDisplay2DInterface::DeleteObjectMessage::DeleteObjectMessage(const uint32_t ini_object_id) : Message("DeleteObjectMessage")
1439 {
1440  data_size = sizeof(DeleteObjectMessage_data_t);
1441  data_ptr = malloc(data_size);
1442  memset(data_ptr, 0, data_size);
1443  data = (DeleteObjectMessage_data_t *)data_ptr;
1445  data->object_id = ini_object_id;
1446  enum_map_LineStyle[(int)LS_SOLID] = "LS_SOLID";
1447  enum_map_LineStyle[(int)LS_DASHED] = "LS_DASHED";
1448  enum_map_LineStyle[(int)LS_DOTTED] = "LS_DOTTED";
1449  enum_map_LineStyle[(int)LS_DASH_DOTTED] = "LS_DASH_DOTTED";
1450  enum_map_Anchor[(int)CENTERED] = "CENTERED";
1451  enum_map_Anchor[(int)NORTH] = "NORTH";
1452  enum_map_Anchor[(int)EAST] = "EAST";
1453  enum_map_Anchor[(int)SOUTH] = "SOUTH";
1454  enum_map_Anchor[(int)WEST] = "WEST";
1455  enum_map_Anchor[(int)NORTH_EAST] = "NORTH_EAST";
1456  enum_map_Anchor[(int)SOUTH_EAST] = "SOUTH_EAST";
1457  enum_map_Anchor[(int)SOUTH_WEST] = "SOUTH_WEST";
1458  enum_map_Anchor[(int)NORTH_WEST] = "NORTH_WEST";
1459  add_fieldinfo(IFT_UINT32, "object_id", 1, &data->object_id);
1460 }
1461 /** Constructor */
1463 {
1464  data_size = sizeof(DeleteObjectMessage_data_t);
1465  data_ptr = malloc(data_size);
1466  memset(data_ptr, 0, data_size);
1467  data = (DeleteObjectMessage_data_t *)data_ptr;
1469  enum_map_LineStyle[(int)LS_SOLID] = "LS_SOLID";
1470  enum_map_LineStyle[(int)LS_DASHED] = "LS_DASHED";
1471  enum_map_LineStyle[(int)LS_DOTTED] = "LS_DOTTED";
1472  enum_map_LineStyle[(int)LS_DASH_DOTTED] = "LS_DASH_DOTTED";
1473  enum_map_Anchor[(int)CENTERED] = "CENTERED";
1474  enum_map_Anchor[(int)NORTH] = "NORTH";
1475  enum_map_Anchor[(int)EAST] = "EAST";
1476  enum_map_Anchor[(int)SOUTH] = "SOUTH";
1477  enum_map_Anchor[(int)WEST] = "WEST";
1478  enum_map_Anchor[(int)NORTH_EAST] = "NORTH_EAST";
1479  enum_map_Anchor[(int)SOUTH_EAST] = "SOUTH_EAST";
1480  enum_map_Anchor[(int)SOUTH_WEST] = "SOUTH_WEST";
1481  enum_map_Anchor[(int)NORTH_WEST] = "NORTH_WEST";
1482  add_fieldinfo(IFT_UINT32, "object_id", 1, &data->object_id);
1483 }
1484 
1485 /** Destructor */
1487 {
1488  free(data_ptr);
1489 }
1490 
1491 /** Copy constructor.
1492  * @param m message to copy from
1493  */
1495 {
1496  data_size = m->data_size;
1497  data_ptr = malloc(data_size);
1498  memcpy(data_ptr, m->data_ptr, data_size);
1499  data = (DeleteObjectMessage_data_t *)data_ptr;
1501 }
1502 
1503 /* Methods */
1504 /** Get object_id value.
1505  * Object ID, which is
1506  the message ID of the Add* message.
1507  * @return object_id value
1508  */
1509 uint32_t
1511 {
1512  return data->object_id;
1513 }
1514 
1515 /** Get maximum length of object_id value.
1516  * @return length of object_id value, can be length of the array or number of
1517  * maximum number of characters for a string
1518  */
1519 size_t
1521 {
1522  return 1;
1523 }
1524 
1525 /** Set object_id value.
1526  * Object ID, which is
1527  the message ID of the Add* message.
1528  * @param new_object_id new object_id value
1529  */
1530 void
1532 {
1533  data->object_id = new_object_id;
1534 }
1535 
1536 /** Clone this message.
1537  * Produces a message of the same type as this message and copies the
1538  * data to the new message.
1539  * @return clone of this message
1540  */
1541 Message *
1543 {
1545 }
1546 /** @class VisualDisplay2DInterface::DeleteAllMessage <interfaces/VisualDisplay2DInterface.h>
1547  * DeleteAllMessage Fawkes BlackBoard Interface Message.
1548  *
1549 
1550  */
1551 
1552 
1553 /** Constructor */
1555 {
1556  data_size = sizeof(DeleteAllMessage_data_t);
1557  data_ptr = malloc(data_size);
1558  memset(data_ptr, 0, data_size);
1559  data = (DeleteAllMessage_data_t *)data_ptr;
1561  enum_map_LineStyle[(int)LS_SOLID] = "LS_SOLID";
1562  enum_map_LineStyle[(int)LS_DASHED] = "LS_DASHED";
1563  enum_map_LineStyle[(int)LS_DOTTED] = "LS_DOTTED";
1564  enum_map_LineStyle[(int)LS_DASH_DOTTED] = "LS_DASH_DOTTED";
1565  enum_map_Anchor[(int)CENTERED] = "CENTERED";
1566  enum_map_Anchor[(int)NORTH] = "NORTH";
1567  enum_map_Anchor[(int)EAST] = "EAST";
1568  enum_map_Anchor[(int)SOUTH] = "SOUTH";
1569  enum_map_Anchor[(int)WEST] = "WEST";
1570  enum_map_Anchor[(int)NORTH_EAST] = "NORTH_EAST";
1571  enum_map_Anchor[(int)SOUTH_EAST] = "SOUTH_EAST";
1572  enum_map_Anchor[(int)SOUTH_WEST] = "SOUTH_WEST";
1573  enum_map_Anchor[(int)NORTH_WEST] = "NORTH_WEST";
1574 }
1575 
1576 /** Destructor */
1578 {
1579  free(data_ptr);
1580 }
1581 
1582 /** Copy constructor.
1583  * @param m message to copy from
1584  */
1586 {
1587  data_size = m->data_size;
1588  data_ptr = malloc(data_size);
1589  memcpy(data_ptr, m->data_ptr, data_size);
1590  data = (DeleteAllMessage_data_t *)data_ptr;
1592 }
1593 
1594 /* Methods */
1595 /** Clone this message.
1596  * Produces a message of the same type as this message and copies the
1597  * data to the new message.
1598  * @return clone of this message
1599  */
1600 Message *
1602 {
1604 }
1605 /** Check if message is valid and can be enqueued.
1606  * @param message Message to check
1607  * @return true if the message is valid, false otherwise.
1608  */
1609 bool
1611 {
1612  const AddCartLineMessage *m0 = dynamic_cast<const AddCartLineMessage *>(message);
1613  if ( m0 != NULL ) {
1614  return true;
1615  }
1616  const AddCartCircleMessage *m1 = dynamic_cast<const AddCartCircleMessage *>(message);
1617  if ( m1 != NULL ) {
1618  return true;
1619  }
1620  const AddCartRectMessage *m2 = dynamic_cast<const AddCartRectMessage *>(message);
1621  if ( m2 != NULL ) {
1622  return true;
1623  }
1624  const AddCartTextMessage *m3 = dynamic_cast<const AddCartTextMessage *>(message);
1625  if ( m3 != NULL ) {
1626  return true;
1627  }
1628  const DeleteObjectMessage *m4 = dynamic_cast<const DeleteObjectMessage *>(message);
1629  if ( m4 != NULL ) {
1630  return true;
1631  }
1632  const DeleteAllMessage *m5 = dynamic_cast<const DeleteAllMessage *>(message);
1633  if ( m5 != NULL ) {
1634  return true;
1635  }
1636  return false;
1637 }
1638 
1639 /// @cond INTERNALS
1640 EXPORT_INTERFACE(VisualDisplay2DInterface)
1641 /// @endcond
1642 
1643 
1644 } // end namespace fawkes
AddCartRectMessage Fawkes BlackBoard Interface Message.
LineStyle
Enumeration defining the possible line styles.
size_t maxlenof_counter() const
Get maximum length of counter value.
void set_anchor(const Anchor new_anchor)
Set anchor value.
void * data_ptr
Pointer to memory that contains local data.
Definition: message.h:124
size_t maxlenof_x() const
Get maximum length of x value.
size_t maxlenof_x() const
Get maximum length of x value.
size_t maxlenof_anchor() const
Get maximum length of anchor value.
size_t maxlenof_color() const
Get maximum length of color value.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
size_t maxlenof_y() const
Get maximum length of y value.
void set_hash(unsigned char *ihash)
Set hash.
Definition: interface.cpp:314
size_t maxlenof_y() const
Get maximum length of y value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
Fawkes library namespace.
const char * tostring_Anchor(Anchor value) const
Convert Anchor constant to string.
size_t maxlenof_radius() const
Get maximum length of radius value.
Timestamp data, must be present and first entries for each interface data structs! This leans on time...
Definition: message.h:129
AddCartCircleMessage Fawkes BlackBoard Interface Message.
void set_radius(const float new_radius)
Set radius value.
virtual Message * clone() const
Clone this message.
unsigned int data_size
Minimal data size to hold data storage.
Definition: interface.h:221
Anchor
Enumeration defining the possible anchor points.
size_t maxlenof_height() const
Get maximum length of height value.
size_t maxlenof_y() const
Get maximum length of y value.
size_t maxlenof_text() const
Get maximum length of text value.
string field
Definition: types.h:47
size_t maxlenof_object_id() const
Get maximum length of object_id value.
byte field, alias for uint8
Definition: types.h:48
virtual Message * clone() const
Clone this message.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
void set_style(const LineStyle new_style)
Set style value.
void set_color(unsigned int index, const uint8_t new_color)
Set color value at given index.
AddCartTextMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_y() const
Get maximum length of y value.
size_t maxlenof_x() const
Get maximum length of x value.
message_data_ts_t * data_ts
data timestamp aliasing pointer
Definition: message.h:133
void add_fieldinfo(interface_fieldtype_t type, const char *name, size_t length, void *value, const char *enumtype=0, const interface_enum_map_t *enum_map=0)
Add an entry to the field info list.
Definition: interface.cpp:335
unsigned int data_size
Size of memory needed to hold all data.
Definition: message.h:125
size_t maxlenof_color() const
Get maximum length of color value.
virtual Message * clone() const
Clone this message.
void add_messageinfo(const char *name)
Add an entry to the message info list.
Definition: interface.cpp:373
uint32_t counter() const
Get counter value.
DeleteObjectMessage Fawkes BlackBoard Interface Message.
bool data_changed
Indicator if data has changed.
Definition: interface.h:222
void set_color(unsigned int index, const uint8_t new_color)
Set color value at given index.
const char * type() const
Get type of interface.
Definition: interface.cpp:651
void * data_ptr
Pointer to local memory storage.
Definition: interface.h:220
virtual Message * clone() const
Clone this message.
Base class for exceptions in Fawkes.
Definition: exception.h:36
size_t maxlenof_style() const
Get maximum length of style value.
AddCartLineMessage Fawkes BlackBoard Interface Message.
void set_height(const float new_height)
Set height value.
size_t maxlenof_color() const
Get maximum length of color value.
void set_x(unsigned int index, const float new_x)
Set x value at given index.
virtual void copy_values(const Interface *other)
Copy values from other interface.
size_t maxlenof_width() const
Get maximum length of width value.
virtual Message * clone() const
Clone this message.
size_t maxlenof_style() const
Get maximum length of style value.
void set_style(const LineStyle new_style)
Set style value.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
Vertically and horitontally centered.
size_t maxlenof_size() const
Get maximum length of size value.
float field
Definition: types.h:45
void set_color(unsigned int index, const uint8_t new_color)
Set color value at given index.
void set_object_id(const uint32_t new_object_id)
Set object_id value.
size_t maxlenof_x() const
Get maximum length of x value.
size_t maxlenof_style() const
Get maximum length of style value.
void set_color(unsigned int index, const uint8_t new_color)
Set color value at given index.
void set_width(const float new_width)
Set width value.
const char * tostring_LineStyle(LineStyle value) const
Convert LineStyle constant to string.
virtual Message * create_message(const char *type) const
Create message based on type name.
DeleteAllMessage Fawkes BlackBoard Interface Message.
interface_data_ts_t * data_ts
Pointer to data casted to timestamp struct.
Definition: interface.h:224
void add_fieldinfo(interface_fieldtype_t type, const char *name, size_t length, void *value, const char *enumtype=0, const interface_enum_map_t *enum_map=0)
Add an entry to the info list.
Definition: message.cpp:436
VisualDisplay2DInterface Fawkes BlackBoard Interface.
virtual Message * clone() const
Clone this message.
32 bit unsigned integer field
Definition: types.h:42
field with interface specific enum type
Definition: types.h:49
void set_y(unsigned int index, const float new_y)
Set y value at given index.
void set_style(const LineStyle new_style)
Set style value.
size_t maxlenof_color() const
Get maximum length of color value.
void set_counter(const uint32_t new_counter)
Set counter value.