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
33namespace 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 */
59VisualDisplay2DInterface::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 */
91VisualDisplay2DInterface::~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 */
99const char *
100VisualDisplay2DInterface::tostring_LineStyle(LineStyle value) const
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 */
114const char *
115VisualDisplay2DInterface::tostring_Anchor(Anchor value) const
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 */
135uint32_t
136VisualDisplay2DInterface::counter() const
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 */
145size_t
146VisualDisplay2DInterface::maxlenof_counter() const
147{
148 return 1;
149}
150
151/** Set counter value.
152 * Field
153 * @param new_counter new counter value
154 */
155void
156VisualDisplay2DInterface::set_counter(const uint32_t new_counter)
157{
158 set_field(data->counter, new_counter);
159}
160
161/* =========== message create =========== */
162Message *
163VisualDisplay2DInterface::create_message(const char *type) const
164{
165 if ( strncmp("AddCartLineMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
166 return new AddCartLineMessage();
167 } else if ( strncmp("AddCartCircleMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
168 return new AddCartCircleMessage();
169 } else if ( strncmp("AddCartRectMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
170 return new AddCartRectMessage();
171 } else if ( strncmp("AddCartTextMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
172 return new AddCartTextMessage();
173 } else if ( strncmp("DeleteObjectMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
174 return new DeleteObjectMessage();
175 } else if ( strncmp("DeleteAllMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
176 return new DeleteAllMessage();
177 } else {
178 throw UnknownTypeException("The given type '%s' does not match any known "
179 "message type for this interface type.", type);
180 }
181}
182
183
184/** Copy values from other interface.
185 * @param other other interface to copy values from
186 */
187void
188VisualDisplay2DInterface::copy_values(const Interface *other)
189{
190 const VisualDisplay2DInterface *oi = dynamic_cast<const VisualDisplay2DInterface *>(other);
191 if (oi == NULL) {
192 throw TypeMismatchException("Can only copy values from interface of same type (%s vs. %s)",
193 type(), other->type());
194 }
195 memcpy(data, oi->data, sizeof(VisualDisplay2DInterface_data_t));
196}
197
198const char *
199VisualDisplay2DInterface::enum_tostring(const char *enumtype, int val) const
200{
201 if (strcmp(enumtype, "LineStyle") == 0) {
202 return tostring_LineStyle((LineStyle)val);
203 }
204 if (strcmp(enumtype, "Anchor") == 0) {
205 return tostring_Anchor((Anchor)val);
206 }
207 throw UnknownTypeException("Unknown enum type %s", enumtype);
208}
209
210/* =========== messages =========== */
211/** @class VisualDisplay2DInterface::AddCartLineMessage <interfaces/VisualDisplay2DInterface.h>
212 * AddCartLineMessage Fawkes BlackBoard Interface Message.
213 *
214
215 */
216
217
218/** Constructor with initial values.
219 * @param ini_x initial value for x
220 * @param ini_y initial value for y
221 * @param ini_style initial value for style
222 * @param ini_color initial value for color
223 */
224VisualDisplay2DInterface::AddCartLineMessage::AddCartLineMessage(const float * ini_x, const float * ini_y, const LineStyle ini_style, const uint8_t * ini_color) : Message("AddCartLineMessage")
225{
226 data_size = sizeof(AddCartLineMessage_data_t);
227 data_ptr = malloc(data_size);
228 memset(data_ptr, 0, data_size);
229 data = (AddCartLineMessage_data_t *)data_ptr;
231 memcpy(data->x, ini_x, sizeof(float) * 2);
232 memcpy(data->y, ini_y, sizeof(float) * 2);
233 data->style = ini_style;
234 memcpy(data->color, ini_color, sizeof(uint8_t) * 4);
235 enum_map_LineStyle[(int)LS_SOLID] = "LS_SOLID";
236 enum_map_LineStyle[(int)LS_DASHED] = "LS_DASHED";
237 enum_map_LineStyle[(int)LS_DOTTED] = "LS_DOTTED";
238 enum_map_LineStyle[(int)LS_DASH_DOTTED] = "LS_DASH_DOTTED";
239 enum_map_Anchor[(int)CENTERED] = "CENTERED";
240 enum_map_Anchor[(int)NORTH] = "NORTH";
241 enum_map_Anchor[(int)EAST] = "EAST";
242 enum_map_Anchor[(int)SOUTH] = "SOUTH";
243 enum_map_Anchor[(int)WEST] = "WEST";
244 enum_map_Anchor[(int)NORTH_EAST] = "NORTH_EAST";
245 enum_map_Anchor[(int)SOUTH_EAST] = "SOUTH_EAST";
246 enum_map_Anchor[(int)SOUTH_WEST] = "SOUTH_WEST";
247 enum_map_Anchor[(int)NORTH_WEST] = "NORTH_WEST";
248 add_fieldinfo(IFT_FLOAT, "x", 2, &data->x);
249 add_fieldinfo(IFT_FLOAT, "y", 2, &data->y);
250 add_fieldinfo(IFT_ENUM, "style", 1, &data->style, "LineStyle", &enum_map_LineStyle);
251 add_fieldinfo(IFT_BYTE, "color", 4, &data->color);
252}
253/** Constructor */
255{
256 data_size = sizeof(AddCartLineMessage_data_t);
257 data_ptr = malloc(data_size);
258 memset(data_ptr, 0, data_size);
259 data = (AddCartLineMessage_data_t *)data_ptr;
261 enum_map_LineStyle[(int)LS_SOLID] = "LS_SOLID";
262 enum_map_LineStyle[(int)LS_DASHED] = "LS_DASHED";
263 enum_map_LineStyle[(int)LS_DOTTED] = "LS_DOTTED";
264 enum_map_LineStyle[(int)LS_DASH_DOTTED] = "LS_DASH_DOTTED";
265 enum_map_Anchor[(int)CENTERED] = "CENTERED";
266 enum_map_Anchor[(int)NORTH] = "NORTH";
267 enum_map_Anchor[(int)EAST] = "EAST";
268 enum_map_Anchor[(int)SOUTH] = "SOUTH";
269 enum_map_Anchor[(int)WEST] = "WEST";
270 enum_map_Anchor[(int)NORTH_EAST] = "NORTH_EAST";
271 enum_map_Anchor[(int)SOUTH_EAST] = "SOUTH_EAST";
272 enum_map_Anchor[(int)SOUTH_WEST] = "SOUTH_WEST";
273 enum_map_Anchor[(int)NORTH_WEST] = "NORTH_WEST";
274 add_fieldinfo(IFT_FLOAT, "x", 2, &data->x);
275 add_fieldinfo(IFT_FLOAT, "y", 2, &data->y);
276 add_fieldinfo(IFT_ENUM, "style", 1, &data->style, "LineStyle", &enum_map_LineStyle);
277 add_fieldinfo(IFT_BYTE, "color", 4, &data->color);
278}
279
280/** Destructor */
282{
283 free(data_ptr);
284}
285
286/** Copy constructor.
287 * @param m message to copy from
288 */
290{
291 data_size = m->data_size;
292 data_ptr = malloc(data_size);
293 memcpy(data_ptr, m->data_ptr, data_size);
294 data = (AddCartLineMessage_data_t *)data_ptr;
296}
297
298/* Methods */
299/** Get x value.
300 * X coordinates of two points
301 * @return x value
302 */
303float *
305{
306 return data->x;
307}
308
309/** Get x value at given index.
310 * X coordinates of two points
311 * @param index index of value
312 * @return x value
313 * @exception Exception thrown if index is out of bounds
314 */
315float
317{
318 if (index > 1) {
319 throw Exception("Index value %u out of bounds (0..1)", index);
320 }
321 return data->x[index];
322}
323
324/** Get maximum length of x value.
325 * @return length of x value, can be length of the array or number of
326 * maximum number of characters for a string
327 */
328size_t
330{
331 return 2;
332}
333
334/** Set x value.
335 * X coordinates of two points
336 * @param new_x new x value
337 */
338void
340{
341 set_field(data->x, new_x);
342}
343
344/** Set x value at given index.
345 * X coordinates of two points
346 * @param new_x new x value
347 * @param index index for of the value
348 */
349void
350VisualDisplay2DInterface::AddCartLineMessage::set_x(unsigned int index, const float new_x)
351{
352 set_field(data->x, index, new_x);
353}
354/** Get y value.
355 * Y coordinates of two
356 points
357 * @return y value
358 */
359float *
361{
362 return data->y;
363}
364
365/** Get y value at given index.
366 * Y coordinates of two
367 points
368 * @param index index of value
369 * @return y value
370 * @exception Exception thrown if index is out of bounds
371 */
372float
374{
375 if (index > 1) {
376 throw Exception("Index value %u out of bounds (0..1)", index);
377 }
378 return data->y[index];
379}
380
381/** Get maximum length of y value.
382 * @return length of y value, can be length of the array or number of
383 * maximum number of characters for a string
384 */
385size_t
387{
388 return 2;
389}
390
391/** Set y value.
392 * Y coordinates of two
393 points
394 * @param new_y new y value
395 */
396void
398{
399 set_field(data->y, new_y);
400}
401
402/** Set y value at given index.
403 * Y coordinates of two
404 points
405 * @param new_y new y value
406 * @param index index for of the value
407 */
408void
409VisualDisplay2DInterface::AddCartLineMessage::set_y(unsigned int index, const float new_y)
410{
411 set_field(data->y, index, new_y);
412}
413/** Get style value.
414 * Style of this object.
415 * @return style value
416 */
419{
420 return (VisualDisplay2DInterface::LineStyle)data->style;
421}
422
423/** Get maximum length of style value.
424 * @return length of style value, can be length of the array or number of
425 * maximum number of characters for a string
426 */
427size_t
429{
430 return 1;
431}
432
433/** Set style value.
434 * Style of this object.
435 * @param new_style new style value
436 */
437void
439{
440 set_field(data->style, new_style);
441}
442
443/** Get color value.
444 * Color in RGBA
445 * @return color value
446 */
447uint8_t *
449{
450 return data->color;
451}
452
453/** Get color value at given index.
454 * Color in RGBA
455 * @param index index of value
456 * @return color value
457 * @exception Exception thrown if index is out of bounds
458 */
459uint8_t
461{
462 if (index > 3) {
463 throw Exception("Index value %u out of bounds (0..3)", index);
464 }
465 return data->color[index];
466}
467
468/** Get maximum length of color value.
469 * @return length of color value, can be length of the array or number of
470 * maximum number of characters for a string
471 */
472size_t
474{
475 return 4;
476}
477
478/** Set color value.
479 * Color in RGBA
480 * @param new_color new color value
481 */
482void
484{
485 set_field(data->color, new_color);
486}
487
488/** Set color value at given index.
489 * Color in RGBA
490 * @param new_color new color value
491 * @param index index for of the value
492 */
493void
494VisualDisplay2DInterface::AddCartLineMessage::set_color(unsigned int index, const uint8_t new_color)
495{
496 set_field(data->color, index, new_color);
497}
498/** Clone this message.
499 * Produces a message of the same type as this message and copies the
500 * data to the new message.
501 * @return clone of this message
502 */
503Message *
505{
507}
508/** @class VisualDisplay2DInterface::AddCartCircleMessage <interfaces/VisualDisplay2DInterface.h>
509 * AddCartCircleMessage Fawkes BlackBoard Interface Message.
510 *
511
512 */
513
514
515/** Constructor with initial values.
516 * @param ini_x initial value for x
517 * @param ini_y initial value for y
518 * @param ini_radius initial value for radius
519 * @param ini_style initial value for style
520 * @param ini_color initial value for color
521 */
522VisualDisplay2DInterface::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")
523{
524 data_size = sizeof(AddCartCircleMessage_data_t);
525 data_ptr = malloc(data_size);
526 memset(data_ptr, 0, data_size);
527 data = (AddCartCircleMessage_data_t *)data_ptr;
529 data->x = ini_x;
530 data->y = ini_y;
531 data->radius = ini_radius;
532 data->style = ini_style;
533 memcpy(data->color, ini_color, sizeof(uint8_t) * 4);
534 enum_map_LineStyle[(int)LS_SOLID] = "LS_SOLID";
535 enum_map_LineStyle[(int)LS_DASHED] = "LS_DASHED";
536 enum_map_LineStyle[(int)LS_DOTTED] = "LS_DOTTED";
537 enum_map_LineStyle[(int)LS_DASH_DOTTED] = "LS_DASH_DOTTED";
538 enum_map_Anchor[(int)CENTERED] = "CENTERED";
539 enum_map_Anchor[(int)NORTH] = "NORTH";
540 enum_map_Anchor[(int)EAST] = "EAST";
541 enum_map_Anchor[(int)SOUTH] = "SOUTH";
542 enum_map_Anchor[(int)WEST] = "WEST";
543 enum_map_Anchor[(int)NORTH_EAST] = "NORTH_EAST";
544 enum_map_Anchor[(int)SOUTH_EAST] = "SOUTH_EAST";
545 enum_map_Anchor[(int)SOUTH_WEST] = "SOUTH_WEST";
546 enum_map_Anchor[(int)NORTH_WEST] = "NORTH_WEST";
547 add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
548 add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
549 add_fieldinfo(IFT_FLOAT, "radius", 1, &data->radius);
550 add_fieldinfo(IFT_ENUM, "style", 1, &data->style, "LineStyle", &enum_map_LineStyle);
551 add_fieldinfo(IFT_BYTE, "color", 4, &data->color);
552}
553/** Constructor */
555{
556 data_size = sizeof(AddCartCircleMessage_data_t);
557 data_ptr = malloc(data_size);
558 memset(data_ptr, 0, data_size);
559 data = (AddCartCircleMessage_data_t *)data_ptr;
561 enum_map_LineStyle[(int)LS_SOLID] = "LS_SOLID";
562 enum_map_LineStyle[(int)LS_DASHED] = "LS_DASHED";
563 enum_map_LineStyle[(int)LS_DOTTED] = "LS_DOTTED";
564 enum_map_LineStyle[(int)LS_DASH_DOTTED] = "LS_DASH_DOTTED";
565 enum_map_Anchor[(int)CENTERED] = "CENTERED";
566 enum_map_Anchor[(int)NORTH] = "NORTH";
567 enum_map_Anchor[(int)EAST] = "EAST";
568 enum_map_Anchor[(int)SOUTH] = "SOUTH";
569 enum_map_Anchor[(int)WEST] = "WEST";
570 enum_map_Anchor[(int)NORTH_EAST] = "NORTH_EAST";
571 enum_map_Anchor[(int)SOUTH_EAST] = "SOUTH_EAST";
572 enum_map_Anchor[(int)SOUTH_WEST] = "SOUTH_WEST";
573 enum_map_Anchor[(int)NORTH_WEST] = "NORTH_WEST";
574 add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
575 add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
576 add_fieldinfo(IFT_FLOAT, "radius", 1, &data->radius);
577 add_fieldinfo(IFT_ENUM, "style", 1, &data->style, "LineStyle", &enum_map_LineStyle);
578 add_fieldinfo(IFT_BYTE, "color", 4, &data->color);
579}
580
581/** Destructor */
583{
584 free(data_ptr);
585}
586
587/** Copy constructor.
588 * @param m message to copy from
589 */
591{
592 data_size = m->data_size;
593 data_ptr = malloc(data_size);
594 memcpy(data_ptr, m->data_ptr, data_size);
595 data = (AddCartCircleMessage_data_t *)data_ptr;
597}
598
599/* Methods */
600/** Get x value.
601 * X coordinate of center point
602 * @return x value
603 */
604float
606{
607 return data->x;
608}
609
610/** Get maximum length of x value.
611 * @return length of x value, can be length of the array or number of
612 * maximum number of characters for a string
613 */
614size_t
616{
617 return 1;
618}
619
620/** Set x value.
621 * X coordinate of center point
622 * @param new_x new x value
623 */
624void
626{
627 set_field(data->x, new_x);
628}
629
630/** Get y value.
631 * Y coordinate of center point
632 * @return y value
633 */
634float
636{
637 return data->y;
638}
639
640/** Get maximum length of y value.
641 * @return length of y value, can be length of the array or number of
642 * maximum number of characters for a string
643 */
644size_t
646{
647 return 1;
648}
649
650/** Set y value.
651 * Y coordinate of center point
652 * @param new_y new y value
653 */
654void
656{
657 set_field(data->y, new_y);
658}
659
660/** Get radius value.
661 * Radius of the circle.
662 * @return radius value
663 */
664float
666{
667 return data->radius;
668}
669
670/** Get maximum length of radius value.
671 * @return length of radius value, can be length of the array or number of
672 * maximum number of characters for a string
673 */
674size_t
676{
677 return 1;
678}
679
680/** Set radius value.
681 * Radius of the circle.
682 * @param new_radius new radius value
683 */
684void
686{
687 set_field(data->radius, new_radius);
688}
689
690/** Get style value.
691 * Style of this object.
692 * @return style value
693 */
696{
697 return (VisualDisplay2DInterface::LineStyle)data->style;
698}
699
700/** Get maximum length of style value.
701 * @return length of style value, can be length of the array or number of
702 * maximum number of characters for a string
703 */
704size_t
706{
707 return 1;
708}
709
710/** Set style value.
711 * Style of this object.
712 * @param new_style new style value
713 */
714void
716{
717 set_field(data->style, new_style);
718}
719
720/** Get color value.
721 * Color in RGBA
722 * @return color value
723 */
724uint8_t *
726{
727 return data->color;
728}
729
730/** Get color value at given index.
731 * Color in RGBA
732 * @param index index of value
733 * @return color value
734 * @exception Exception thrown if index is out of bounds
735 */
736uint8_t
738{
739 if (index > 3) {
740 throw Exception("Index value %u out of bounds (0..3)", index);
741 }
742 return data->color[index];
743}
744
745/** Get maximum length of color value.
746 * @return length of color value, can be length of the array or number of
747 * maximum number of characters for a string
748 */
749size_t
751{
752 return 4;
753}
754
755/** Set color value.
756 * Color in RGBA
757 * @param new_color new color value
758 */
759void
761{
762 set_field(data->color, new_color);
763}
764
765/** Set color value at given index.
766 * Color in RGBA
767 * @param new_color new color value
768 * @param index index for of the value
769 */
770void
771VisualDisplay2DInterface::AddCartCircleMessage::set_color(unsigned int index, const uint8_t new_color)
772{
773 set_field(data->color, index, new_color);
774}
775/** Clone this message.
776 * Produces a message of the same type as this message and copies the
777 * data to the new message.
778 * @return clone of this message
779 */
780Message *
782{
784}
785/** @class VisualDisplay2DInterface::AddCartRectMessage <interfaces/VisualDisplay2DInterface.h>
786 * AddCartRectMessage Fawkes BlackBoard Interface Message.
787 *
788
789 */
790
791
792/** Constructor with initial values.
793 * @param ini_x initial value for x
794 * @param ini_y initial value for y
795 * @param ini_width initial value for width
796 * @param ini_height initial value for height
797 * @param ini_style initial value for style
798 * @param ini_color initial value for color
799 */
800VisualDisplay2DInterface::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")
801{
802 data_size = sizeof(AddCartRectMessage_data_t);
803 data_ptr = malloc(data_size);
804 memset(data_ptr, 0, data_size);
805 data = (AddCartRectMessage_data_t *)data_ptr;
807 data->x = ini_x;
808 data->y = ini_y;
809 data->width = ini_width;
810 data->height = ini_height;
811 data->style = ini_style;
812 memcpy(data->color, ini_color, sizeof(uint8_t) * 4);
813 enum_map_LineStyle[(int)LS_SOLID] = "LS_SOLID";
814 enum_map_LineStyle[(int)LS_DASHED] = "LS_DASHED";
815 enum_map_LineStyle[(int)LS_DOTTED] = "LS_DOTTED";
816 enum_map_LineStyle[(int)LS_DASH_DOTTED] = "LS_DASH_DOTTED";
817 enum_map_Anchor[(int)CENTERED] = "CENTERED";
818 enum_map_Anchor[(int)NORTH] = "NORTH";
819 enum_map_Anchor[(int)EAST] = "EAST";
820 enum_map_Anchor[(int)SOUTH] = "SOUTH";
821 enum_map_Anchor[(int)WEST] = "WEST";
822 enum_map_Anchor[(int)NORTH_EAST] = "NORTH_EAST";
823 enum_map_Anchor[(int)SOUTH_EAST] = "SOUTH_EAST";
824 enum_map_Anchor[(int)SOUTH_WEST] = "SOUTH_WEST";
825 enum_map_Anchor[(int)NORTH_WEST] = "NORTH_WEST";
826 add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
827 add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
828 add_fieldinfo(IFT_FLOAT, "width", 1, &data->width);
829 add_fieldinfo(IFT_FLOAT, "height", 1, &data->height);
830 add_fieldinfo(IFT_ENUM, "style", 1, &data->style, "LineStyle", &enum_map_LineStyle);
831 add_fieldinfo(IFT_BYTE, "color", 4, &data->color);
832}
833/** Constructor */
835{
836 data_size = sizeof(AddCartRectMessage_data_t);
837 data_ptr = malloc(data_size);
838 memset(data_ptr, 0, data_size);
839 data = (AddCartRectMessage_data_t *)data_ptr;
841 enum_map_LineStyle[(int)LS_SOLID] = "LS_SOLID";
842 enum_map_LineStyle[(int)LS_DASHED] = "LS_DASHED";
843 enum_map_LineStyle[(int)LS_DOTTED] = "LS_DOTTED";
844 enum_map_LineStyle[(int)LS_DASH_DOTTED] = "LS_DASH_DOTTED";
845 enum_map_Anchor[(int)CENTERED] = "CENTERED";
846 enum_map_Anchor[(int)NORTH] = "NORTH";
847 enum_map_Anchor[(int)EAST] = "EAST";
848 enum_map_Anchor[(int)SOUTH] = "SOUTH";
849 enum_map_Anchor[(int)WEST] = "WEST";
850 enum_map_Anchor[(int)NORTH_EAST] = "NORTH_EAST";
851 enum_map_Anchor[(int)SOUTH_EAST] = "SOUTH_EAST";
852 enum_map_Anchor[(int)SOUTH_WEST] = "SOUTH_WEST";
853 enum_map_Anchor[(int)NORTH_WEST] = "NORTH_WEST";
854 add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
855 add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
856 add_fieldinfo(IFT_FLOAT, "width", 1, &data->width);
857 add_fieldinfo(IFT_FLOAT, "height", 1, &data->height);
858 add_fieldinfo(IFT_ENUM, "style", 1, &data->style, "LineStyle", &enum_map_LineStyle);
859 add_fieldinfo(IFT_BYTE, "color", 4, &data->color);
860}
861
862/** Destructor */
864{
865 free(data_ptr);
866}
867
868/** Copy constructor.
869 * @param m message to copy from
870 */
872{
873 data_size = m->data_size;
874 data_ptr = malloc(data_size);
875 memcpy(data_ptr, m->data_ptr, data_size);
876 data = (AddCartRectMessage_data_t *)data_ptr;
878}
879
880/* Methods */
881/** Get x value.
882 * X coordinate of lower right corner
883 * @return x value
884 */
885float
887{
888 return data->x;
889}
890
891/** Get maximum length of x value.
892 * @return length of x value, can be length of the array or number of
893 * maximum number of characters for a string
894 */
895size_t
897{
898 return 1;
899}
900
901/** Set x value.
902 * X coordinate of lower right corner
903 * @param new_x new x value
904 */
905void
907{
908 set_field(data->x, new_x);
909}
910
911/** Get y value.
912 * Y coordinate of lower right corner
913 * @return y value
914 */
915float
917{
918 return data->y;
919}
920
921/** Get maximum length of y value.
922 * @return length of y value, can be length of the array or number of
923 * maximum number of characters for a string
924 */
925size_t
927{
928 return 1;
929}
930
931/** Set y value.
932 * Y coordinate of lower right corner
933 * @param new_y new y value
934 */
935void
937{
938 set_field(data->y, new_y);
939}
940
941/** Get width value.
942 * Width of rectangle
943 * @return width value
944 */
945float
947{
948 return data->width;
949}
950
951/** Get maximum length of width value.
952 * @return length of width value, can be length of the array or number of
953 * maximum number of characters for a string
954 */
955size_t
957{
958 return 1;
959}
960
961/** Set width value.
962 * Width of rectangle
963 * @param new_width new width value
964 */
965void
967{
968 set_field(data->width, new_width);
969}
970
971/** Get height value.
972 * Height of rectangle
973 * @return height value
974 */
975float
977{
978 return data->height;
979}
980
981/** Get maximum length of height value.
982 * @return length of height value, can be length of the array or number of
983 * maximum number of characters for a string
984 */
985size_t
987{
988 return 1;
989}
990
991/** Set height value.
992 * Height of rectangle
993 * @param new_height new height value
994 */
995void
997{
998 set_field(data->height, new_height);
999}
1000
1001/** Get style value.
1002 * Style of this object.
1003 * @return style value
1004 */
1007{
1008 return (VisualDisplay2DInterface::LineStyle)data->style;
1009}
1010
1011/** Get maximum length of style value.
1012 * @return length of style value, can be length of the array or number of
1013 * maximum number of characters for a string
1014 */
1015size_t
1017{
1018 return 1;
1019}
1020
1021/** Set style value.
1022 * Style of this object.
1023 * @param new_style new style value
1024 */
1025void
1027{
1028 set_field(data->style, new_style);
1029}
1030
1031/** Get color value.
1032 * Color in RGBA
1033 * @return color value
1034 */
1035uint8_t *
1037{
1038 return data->color;
1039}
1040
1041/** Get color value at given index.
1042 * Color in RGBA
1043 * @param index index of value
1044 * @return color value
1045 * @exception Exception thrown if index is out of bounds
1046 */
1047uint8_t
1049{
1050 if (index > 3) {
1051 throw Exception("Index value %u out of bounds (0..3)", index);
1052 }
1053 return data->color[index];
1054}
1055
1056/** Get maximum length of color value.
1057 * @return length of color value, can be length of the array or number of
1058 * maximum number of characters for a string
1059 */
1060size_t
1062{
1063 return 4;
1064}
1065
1066/** Set color value.
1067 * Color in RGBA
1068 * @param new_color new color value
1069 */
1070void
1072{
1073 set_field(data->color, new_color);
1074}
1075
1076/** Set color value at given index.
1077 * Color in RGBA
1078 * @param new_color new color value
1079 * @param index index for of the value
1080 */
1081void
1082VisualDisplay2DInterface::AddCartRectMessage::set_color(unsigned int index, const uint8_t new_color)
1083{
1084 set_field(data->color, index, new_color);
1085}
1086/** Clone this message.
1087 * Produces a message of the same type as this message and copies the
1088 * data to the new message.
1089 * @return clone of this message
1090 */
1091Message *
1093{
1095}
1096/** @class VisualDisplay2DInterface::AddCartTextMessage <interfaces/VisualDisplay2DInterface.h>
1097 * AddCartTextMessage Fawkes BlackBoard Interface Message.
1098 *
1099
1100 */
1101
1102
1103/** Constructor with initial values.
1104 * @param ini_x initial value for x
1105 * @param ini_y initial value for y
1106 * @param ini_text initial value for text
1107 * @param ini_anchor initial value for anchor
1108 * @param ini_size initial value for size
1109 * @param ini_color initial value for color
1110 */
1111VisualDisplay2DInterface::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")
1112{
1113 data_size = sizeof(AddCartTextMessage_data_t);
1114 data_ptr = malloc(data_size);
1115 memset(data_ptr, 0, data_size);
1116 data = (AddCartTextMessage_data_t *)data_ptr;
1118 data->x = ini_x;
1119 data->y = ini_y;
1120 strncpy(data->text, ini_text, 128-1);
1121 data->text[128-1] = 0;
1122 data->anchor = ini_anchor;
1123 data->size = ini_size;
1124 memcpy(data->color, ini_color, sizeof(uint8_t) * 4);
1125 enum_map_LineStyle[(int)LS_SOLID] = "LS_SOLID";
1126 enum_map_LineStyle[(int)LS_DASHED] = "LS_DASHED";
1127 enum_map_LineStyle[(int)LS_DOTTED] = "LS_DOTTED";
1128 enum_map_LineStyle[(int)LS_DASH_DOTTED] = "LS_DASH_DOTTED";
1129 enum_map_Anchor[(int)CENTERED] = "CENTERED";
1130 enum_map_Anchor[(int)NORTH] = "NORTH";
1131 enum_map_Anchor[(int)EAST] = "EAST";
1132 enum_map_Anchor[(int)SOUTH] = "SOUTH";
1133 enum_map_Anchor[(int)WEST] = "WEST";
1134 enum_map_Anchor[(int)NORTH_EAST] = "NORTH_EAST";
1135 enum_map_Anchor[(int)SOUTH_EAST] = "SOUTH_EAST";
1136 enum_map_Anchor[(int)SOUTH_WEST] = "SOUTH_WEST";
1137 enum_map_Anchor[(int)NORTH_WEST] = "NORTH_WEST";
1138 add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
1139 add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
1140 add_fieldinfo(IFT_STRING, "text", 128, data->text);
1141 add_fieldinfo(IFT_ENUM, "anchor", 1, &data->anchor, "Anchor", &enum_map_Anchor);
1142 add_fieldinfo(IFT_FLOAT, "size", 1, &data->size);
1143 add_fieldinfo(IFT_BYTE, "color", 4, &data->color);
1144}
1145/** Constructor */
1147{
1148 data_size = sizeof(AddCartTextMessage_data_t);
1149 data_ptr = malloc(data_size);
1150 memset(data_ptr, 0, data_size);
1151 data = (AddCartTextMessage_data_t *)data_ptr;
1153 enum_map_LineStyle[(int)LS_SOLID] = "LS_SOLID";
1154 enum_map_LineStyle[(int)LS_DASHED] = "LS_DASHED";
1155 enum_map_LineStyle[(int)LS_DOTTED] = "LS_DOTTED";
1156 enum_map_LineStyle[(int)LS_DASH_DOTTED] = "LS_DASH_DOTTED";
1157 enum_map_Anchor[(int)CENTERED] = "CENTERED";
1158 enum_map_Anchor[(int)NORTH] = "NORTH";
1159 enum_map_Anchor[(int)EAST] = "EAST";
1160 enum_map_Anchor[(int)SOUTH] = "SOUTH";
1161 enum_map_Anchor[(int)WEST] = "WEST";
1162 enum_map_Anchor[(int)NORTH_EAST] = "NORTH_EAST";
1163 enum_map_Anchor[(int)SOUTH_EAST] = "SOUTH_EAST";
1164 enum_map_Anchor[(int)SOUTH_WEST] = "SOUTH_WEST";
1165 enum_map_Anchor[(int)NORTH_WEST] = "NORTH_WEST";
1166 add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
1167 add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
1168 add_fieldinfo(IFT_STRING, "text", 128, data->text);
1169 add_fieldinfo(IFT_ENUM, "anchor", 1, &data->anchor, "Anchor", &enum_map_Anchor);
1170 add_fieldinfo(IFT_FLOAT, "size", 1, &data->size);
1171 add_fieldinfo(IFT_BYTE, "color", 4, &data->color);
1172}
1173
1174/** Destructor */
1176{
1177 free(data_ptr);
1178}
1179
1180/** Copy constructor.
1181 * @param m message to copy from
1182 */
1184{
1185 data_size = m->data_size;
1186 data_ptr = malloc(data_size);
1187 memcpy(data_ptr, m->data_ptr, data_size);
1188 data = (AddCartTextMessage_data_t *)data_ptr;
1190}
1191
1192/* Methods */
1193/** Get x value.
1194 * X coordinate of upper left corner
1195 * @return x value
1196 */
1197float
1199{
1200 return data->x;
1201}
1202
1203/** Get maximum length of x value.
1204 * @return length of x value, can be length of the array or number of
1205 * maximum number of characters for a string
1206 */
1207size_t
1209{
1210 return 1;
1211}
1212
1213/** Set x value.
1214 * X coordinate of upper left corner
1215 * @param new_x new x value
1216 */
1217void
1219{
1220 set_field(data->x, new_x);
1221}
1222
1223/** Get y value.
1224 * Y coordinate of upper left corner
1225 * @return y value
1226 */
1227float
1229{
1230 return data->y;
1231}
1232
1233/** Get maximum length of y value.
1234 * @return length of y value, can be length of the array or number of
1235 * maximum number of characters for a string
1236 */
1237size_t
1239{
1240 return 1;
1241}
1242
1243/** Set y value.
1244 * Y coordinate of upper left corner
1245 * @param new_y new y value
1246 */
1247void
1249{
1250 set_field(data->y, new_y);
1251}
1252
1253/** Get text value.
1254 * Width of rectangle
1255 * @return text value
1256 */
1257char *
1259{
1260 return data->text;
1261}
1262
1263/** Get maximum length of text value.
1264 * @return length of text value, can be length of the array or number of
1265 * maximum number of characters for a string
1266 */
1267size_t
1269{
1270 return 128;
1271}
1272
1273/** Set text value.
1274 * Width of rectangle
1275 * @param new_text new text value
1276 */
1277void
1279{
1280 set_field(data->text, new_text);
1281}
1282
1283/** Get anchor value.
1284 * Anchor which marks the
1285 alignment to the given point.
1286 * @return anchor value
1287 */
1290{
1291 return (VisualDisplay2DInterface::Anchor)data->anchor;
1292}
1293
1294/** Get maximum length of anchor value.
1295 * @return length of anchor value, can be length of the array or number of
1296 * maximum number of characters for a string
1297 */
1298size_t
1300{
1301 return 1;
1302}
1303
1304/** Set anchor value.
1305 * Anchor which marks the
1306 alignment to the given point.
1307 * @param new_anchor new anchor value
1308 */
1309void
1311{
1312 set_field(data->anchor, new_anchor);
1313}
1314
1315/** Get size value.
1316 * Font size (max height in m).
1317 * @return size value
1318 */
1319float
1321{
1322 return data->size;
1323}
1324
1325/** Get maximum length of size value.
1326 * @return length of size value, can be length of the array or number of
1327 * maximum number of characters for a string
1328 */
1329size_t
1331{
1332 return 1;
1333}
1334
1335/** Set size value.
1336 * Font size (max height in m).
1337 * @param new_size new size value
1338 */
1339void
1341{
1342 set_field(data->size, new_size);
1343}
1344
1345/** Get color value.
1346 * Color in RGBA
1347 * @return color value
1348 */
1349uint8_t *
1351{
1352 return data->color;
1353}
1354
1355/** Get color value at given index.
1356 * Color in RGBA
1357 * @param index index of value
1358 * @return color value
1359 * @exception Exception thrown if index is out of bounds
1360 */
1361uint8_t
1363{
1364 if (index > 3) {
1365 throw Exception("Index value %u out of bounds (0..3)", index);
1366 }
1367 return data->color[index];
1368}
1369
1370/** Get maximum length of color value.
1371 * @return length of color value, can be length of the array or number of
1372 * maximum number of characters for a string
1373 */
1374size_t
1376{
1377 return 4;
1378}
1379
1380/** Set color value.
1381 * Color in RGBA
1382 * @param new_color new color value
1383 */
1384void
1386{
1387 set_field(data->color, new_color);
1388}
1389
1390/** Set color value at given index.
1391 * Color in RGBA
1392 * @param new_color new color value
1393 * @param index index for of the value
1394 */
1395void
1396VisualDisplay2DInterface::AddCartTextMessage::set_color(unsigned int index, const uint8_t new_color)
1397{
1398 set_field(data->color, index, new_color);
1399}
1400/** Clone this message.
1401 * Produces a message of the same type as this message and copies the
1402 * data to the new message.
1403 * @return clone of this message
1404 */
1405Message *
1407{
1409}
1410/** @class VisualDisplay2DInterface::DeleteObjectMessage <interfaces/VisualDisplay2DInterface.h>
1411 * DeleteObjectMessage Fawkes BlackBoard Interface Message.
1412 *
1413
1414 */
1415
1416
1417/** Constructor with initial values.
1418 * @param ini_object_id initial value for object_id
1419 */
1420VisualDisplay2DInterface::DeleteObjectMessage::DeleteObjectMessage(const uint32_t ini_object_id) : Message("DeleteObjectMessage")
1421{
1422 data_size = sizeof(DeleteObjectMessage_data_t);
1423 data_ptr = malloc(data_size);
1424 memset(data_ptr, 0, data_size);
1425 data = (DeleteObjectMessage_data_t *)data_ptr;
1427 data->object_id = ini_object_id;
1428 enum_map_LineStyle[(int)LS_SOLID] = "LS_SOLID";
1429 enum_map_LineStyle[(int)LS_DASHED] = "LS_DASHED";
1430 enum_map_LineStyle[(int)LS_DOTTED] = "LS_DOTTED";
1431 enum_map_LineStyle[(int)LS_DASH_DOTTED] = "LS_DASH_DOTTED";
1432 enum_map_Anchor[(int)CENTERED] = "CENTERED";
1433 enum_map_Anchor[(int)NORTH] = "NORTH";
1434 enum_map_Anchor[(int)EAST] = "EAST";
1435 enum_map_Anchor[(int)SOUTH] = "SOUTH";
1436 enum_map_Anchor[(int)WEST] = "WEST";
1437 enum_map_Anchor[(int)NORTH_EAST] = "NORTH_EAST";
1438 enum_map_Anchor[(int)SOUTH_EAST] = "SOUTH_EAST";
1439 enum_map_Anchor[(int)SOUTH_WEST] = "SOUTH_WEST";
1440 enum_map_Anchor[(int)NORTH_WEST] = "NORTH_WEST";
1441 add_fieldinfo(IFT_UINT32, "object_id", 1, &data->object_id);
1442}
1443/** Constructor */
1445{
1446 data_size = sizeof(DeleteObjectMessage_data_t);
1447 data_ptr = malloc(data_size);
1448 memset(data_ptr, 0, data_size);
1449 data = (DeleteObjectMessage_data_t *)data_ptr;
1451 enum_map_LineStyle[(int)LS_SOLID] = "LS_SOLID";
1452 enum_map_LineStyle[(int)LS_DASHED] = "LS_DASHED";
1453 enum_map_LineStyle[(int)LS_DOTTED] = "LS_DOTTED";
1454 enum_map_LineStyle[(int)LS_DASH_DOTTED] = "LS_DASH_DOTTED";
1455 enum_map_Anchor[(int)CENTERED] = "CENTERED";
1456 enum_map_Anchor[(int)NORTH] = "NORTH";
1457 enum_map_Anchor[(int)EAST] = "EAST";
1458 enum_map_Anchor[(int)SOUTH] = "SOUTH";
1459 enum_map_Anchor[(int)WEST] = "WEST";
1460 enum_map_Anchor[(int)NORTH_EAST] = "NORTH_EAST";
1461 enum_map_Anchor[(int)SOUTH_EAST] = "SOUTH_EAST";
1462 enum_map_Anchor[(int)SOUTH_WEST] = "SOUTH_WEST";
1463 enum_map_Anchor[(int)NORTH_WEST] = "NORTH_WEST";
1464 add_fieldinfo(IFT_UINT32, "object_id", 1, &data->object_id);
1465}
1466
1467/** Destructor */
1469{
1470 free(data_ptr);
1471}
1472
1473/** Copy constructor.
1474 * @param m message to copy from
1475 */
1477{
1478 data_size = m->data_size;
1479 data_ptr = malloc(data_size);
1480 memcpy(data_ptr, m->data_ptr, data_size);
1481 data = (DeleteObjectMessage_data_t *)data_ptr;
1483}
1484
1485/* Methods */
1486/** Get object_id value.
1487 * Object ID, which is
1488 the message ID of the Add* message.
1489 * @return object_id value
1490 */
1491uint32_t
1493{
1494 return data->object_id;
1495}
1496
1497/** Get maximum length of object_id value.
1498 * @return length of object_id value, can be length of the array or number of
1499 * maximum number of characters for a string
1500 */
1501size_t
1503{
1504 return 1;
1505}
1506
1507/** Set object_id value.
1508 * Object ID, which is
1509 the message ID of the Add* message.
1510 * @param new_object_id new object_id value
1511 */
1512void
1514{
1515 set_field(data->object_id, new_object_id);
1516}
1517
1518/** Clone this message.
1519 * Produces a message of the same type as this message and copies the
1520 * data to the new message.
1521 * @return clone of this message
1522 */
1523Message *
1525{
1527}
1528/** @class VisualDisplay2DInterface::DeleteAllMessage <interfaces/VisualDisplay2DInterface.h>
1529 * DeleteAllMessage Fawkes BlackBoard Interface Message.
1530 *
1531
1532 */
1533
1534
1535/** Constructor */
1537{
1538 data_size = sizeof(DeleteAllMessage_data_t);
1539 data_ptr = malloc(data_size);
1540 memset(data_ptr, 0, data_size);
1541 data = (DeleteAllMessage_data_t *)data_ptr;
1543 enum_map_LineStyle[(int)LS_SOLID] = "LS_SOLID";
1544 enum_map_LineStyle[(int)LS_DASHED] = "LS_DASHED";
1545 enum_map_LineStyle[(int)LS_DOTTED] = "LS_DOTTED";
1546 enum_map_LineStyle[(int)LS_DASH_DOTTED] = "LS_DASH_DOTTED";
1547 enum_map_Anchor[(int)CENTERED] = "CENTERED";
1548 enum_map_Anchor[(int)NORTH] = "NORTH";
1549 enum_map_Anchor[(int)EAST] = "EAST";
1550 enum_map_Anchor[(int)SOUTH] = "SOUTH";
1551 enum_map_Anchor[(int)WEST] = "WEST";
1552 enum_map_Anchor[(int)NORTH_EAST] = "NORTH_EAST";
1553 enum_map_Anchor[(int)SOUTH_EAST] = "SOUTH_EAST";
1554 enum_map_Anchor[(int)SOUTH_WEST] = "SOUTH_WEST";
1555 enum_map_Anchor[(int)NORTH_WEST] = "NORTH_WEST";
1556}
1557
1558/** Destructor */
1560{
1561 free(data_ptr);
1562}
1563
1564/** Copy constructor.
1565 * @param m message to copy from
1566 */
1568{
1569 data_size = m->data_size;
1570 data_ptr = malloc(data_size);
1571 memcpy(data_ptr, m->data_ptr, data_size);
1572 data = (DeleteAllMessage_data_t *)data_ptr;
1574}
1575
1576/* Methods */
1577/** Clone this message.
1578 * Produces a message of the same type as this message and copies the
1579 * data to the new message.
1580 * @return clone of this message
1581 */
1582Message *
1584{
1586}
1587/** Check if message is valid and can be enqueued.
1588 * @param message Message to check
1589 * @return true if the message is valid, false otherwise.
1590 */
1591bool
1593{
1594 const AddCartLineMessage *m0 = dynamic_cast<const AddCartLineMessage *>(message);
1595 if ( m0 != NULL ) {
1596 return true;
1597 }
1598 const AddCartCircleMessage *m1 = dynamic_cast<const AddCartCircleMessage *>(message);
1599 if ( m1 != NULL ) {
1600 return true;
1601 }
1602 const AddCartRectMessage *m2 = dynamic_cast<const AddCartRectMessage *>(message);
1603 if ( m2 != NULL ) {
1604 return true;
1605 }
1606 const AddCartTextMessage *m3 = dynamic_cast<const AddCartTextMessage *>(message);
1607 if ( m3 != NULL ) {
1608 return true;
1609 }
1610 const DeleteObjectMessage *m4 = dynamic_cast<const DeleteObjectMessage *>(message);
1611 if ( m4 != NULL ) {
1612 return true;
1613 }
1614 const DeleteAllMessage *m5 = dynamic_cast<const DeleteAllMessage *>(message);
1615 if ( m5 != NULL ) {
1616 return true;
1617 }
1618 return false;
1619}
1620
1621/// @cond INTERNALS
1622EXPORT_INTERFACE(VisualDisplay2DInterface)
1623/// @endcond
1624
1625
1626} // end namespace fawkes
Base class for exceptions in Fawkes.
Definition: exception.h:36
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
const char * type() const
Get type of interface.
Definition: interface.cpp:652
void * data_ptr
Pointer to local memory storage.
Definition: interface.h:244
void set_field(FieldT &field, DataT &data)
Set a field, set data_changed to true and update data_changed accordingly.
Definition: interface.h:304
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
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:435
void * data_ptr
Pointer to memory that contains local data.
Definition: message.h:146
message_data_ts_t * data_ts
data timestamp aliasing pointer
Definition: message.h:156
unsigned int data_size
Size of memory needed to hold all data.
Definition: message.h:147
AddCartCircleMessage Fawkes BlackBoard Interface Message.
void set_style(const LineStyle new_style)
Set style value.
virtual Message * clone() const
Clone this message.
size_t maxlenof_x() const
Get maximum length of x value.
size_t maxlenof_y() const
Get maximum length of y value.
size_t maxlenof_color() const
Get maximum length of color value.
size_t maxlenof_radius() const
Get maximum length of radius 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_radius(const float new_radius)
Set radius value.
AddCartLineMessage Fawkes BlackBoard Interface Message.
void set_x(unsigned int index, const float new_x)
Set x value at given index.
size_t maxlenof_color() const
Get maximum length of color value.
size_t maxlenof_x() const
Get maximum length of x 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.
void set_color(unsigned int index, const uint8_t new_color)
Set color value at given index.
size_t maxlenof_y() const
Get maximum length of y value.
void set_y(unsigned int index, const float new_y)
Set y value at given index.
AddCartRectMessage Fawkes BlackBoard Interface Message.
void set_width(const float new_width)
Set width value.
size_t maxlenof_y() const
Get maximum length of y value.
void set_style(const LineStyle new_style)
Set style value.
void set_height(const float new_height)
Set height value.
void set_color(unsigned int index, const uint8_t new_color)
Set color value at given index.
size_t maxlenof_height() const
Get maximum length of height value.
size_t maxlenof_color() const
Get maximum length of color value.
virtual Message * clone() const
Clone this message.
size_t maxlenof_width() const
Get maximum length of width value.
size_t maxlenof_style() const
Get maximum length of style value.
size_t maxlenof_x() const
Get maximum length of x value.
AddCartTextMessage Fawkes BlackBoard Interface Message.
virtual Message * clone() const
Clone this message.
size_t maxlenof_x() const
Get maximum length of x value.
size_t maxlenof_size() const
Get maximum length of size value.
size_t maxlenof_color() const
Get maximum length of color value.
size_t maxlenof_y() const
Get maximum length of y value.
size_t maxlenof_text() const
Get maximum length of text value.
void set_anchor(const Anchor new_anchor)
Set anchor value.
void set_color(unsigned int index, const uint8_t new_color)
Set color value at given index.
size_t maxlenof_anchor() const
Get maximum length of anchor value.
DeleteAllMessage Fawkes BlackBoard Interface Message.
virtual Message * clone() const
Clone this message.
DeleteObjectMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_object_id() const
Get maximum length of object_id value.
virtual Message * clone() const
Clone this message.
void set_object_id(const uint32_t new_object_id)
Set object_id value.
VisualDisplay2DInterface Fawkes BlackBoard Interface.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
Anchor
Enumeration defining the possible anchor points.
@ CENTERED
Vertically and horitontally centered.
LineStyle
Enumeration defining the possible line styles.
Fawkes library namespace.
@ IFT_UINT32
32 bit unsigned integer field
Definition: types.h:43
@ IFT_FLOAT
float field
Definition: types.h:46
@ IFT_BYTE
byte field, alias for uint8
Definition: types.h:49
@ IFT_STRING
string field
Definition: types.h:48
@ IFT_ENUM
field with interface specific enum type
Definition: types.h:50
Timestamp data, must be present and first entries for each interface data structs!...
Definition: message.h:152