Fawkes API  Fawkes Development Version
VisualDisplay2DInterface.h
1 
2 /***************************************************************************
3  * VisualDisplay2DInterface.h - 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 #ifndef __INTERFACES_VISUALDISPLAY2DINTERFACE_H_
25 #define __INTERFACES_VISUALDISPLAY2DINTERFACE_H_
26 
27 #include <interface/interface.h>
28 #include <interface/message.h>
29 #include <interface/field_iterator.h>
30 
31 namespace fawkes {
32 
34 {
35  /// @cond INTERNALS
36  INTERFACE_MGMT_FRIENDS(VisualDisplay2DInterface)
37  /// @endcond
38  public:
39  /* constants */
40 
41  /**
42  Enumeration defining the possible line styles.
43  */
44  typedef enum {
45  LS_SOLID /**< Solid line. */,
46  LS_DASHED /**< Dashed line. */,
47  LS_DOTTED /**< Dotted line. */,
48  LS_DASH_DOTTED /**< Dashed and dotted line */
49  } LineStyle;
50  const char * tostring_LineStyle(LineStyle value) const;
51 
52  /**
53  Enumeration defining the possible anchor points. They are used
54  for determining text alignment towards the reference point. The
55  point is at the appropriate position of the bounding box of
56  the text.
57  */
58  typedef enum {
59  CENTERED /**< Vertically and horitontally centered. */,
60  NORTH /**< Top and horiz. centered. */,
61  EAST /**< Right and vert. centered. */,
62  SOUTH /**< Bottom and horiz. centered. */,
63  WEST /**< Left Right . */,
64  NORTH_EAST /**< Top right. */,
65  SOUTH_EAST /**< Bottom right. */,
66  SOUTH_WEST /**< Bottom left. */,
67  NORTH_WEST /**< Top left. */
68  } Anchor;
69  const char * tostring_Anchor(Anchor value) const;
70 
71  private:
72  /** Internal data storage, do NOT modify! */
73  typedef struct __attribute__((packed)) {
74  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
75  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
76  uint32_t counter; /**< Field */
77  } VisualDisplay2DInterface_data_t;
78 
79  VisualDisplay2DInterface_data_t *data;
80 
81  interface_enum_map_t enum_map_LineStyle;
82  interface_enum_map_t enum_map_Anchor;
83  public:
84  /* messages */
85  class AddCartLineMessage : public Message
86  {
87  private:
88  /** Internal data storage, do NOT modify! */
89  typedef struct __attribute__((packed)) {
90  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
91  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
92  float x[2]; /**< X coordinates of two points */
93  float y[2]; /**< Y coordinates of two
94  points */
95  int32_t style; /**< Style of this object. */
96  uint8_t color[4]; /**< Color in RGBA */
97  } AddCartLineMessage_data_t;
98 
99  AddCartLineMessage_data_t *data;
100 
101  interface_enum_map_t enum_map_LineStyle;
102  interface_enum_map_t enum_map_Anchor;
103  public:
104  AddCartLineMessage(const float * ini_x, const float * ini_y, const LineStyle ini_style, const uint8_t * ini_color);
107 
109  /* Methods */
110  float * x() const;
111  float x(unsigned int index) const;
112  void set_x(unsigned int index, const float new_x);
113  void set_x(const float * new_x);
114  size_t maxlenof_x() const;
115  float * y() const;
116  float y(unsigned int index) const;
117  void set_y(unsigned int index, const float new_y);
118  void set_y(const float * new_y);
119  size_t maxlenof_y() const;
120  LineStyle style() const;
121  void set_style(const LineStyle new_style);
122  size_t maxlenof_style() const;
123  uint8_t * color() const;
124  uint8_t color(unsigned int index) const;
125  void set_color(unsigned int index, const uint8_t new_color);
126  void set_color(const uint8_t * new_color);
127  size_t maxlenof_color() const;
128  virtual Message * clone() const;
129  };
130 
132  {
133  private:
134  /** Internal data storage, do NOT modify! */
135  typedef struct __attribute__((packed)) {
136  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
137  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
138  float x; /**< X coordinate of center point */
139  float y; /**< Y coordinate of center point */
140  float radius; /**< Radius of the circle. */
141  int32_t style; /**< Style of this object. */
142  uint8_t color[4]; /**< Color in RGBA */
143  } AddCartCircleMessage_data_t;
144 
145  AddCartCircleMessage_data_t *data;
146 
147  interface_enum_map_t enum_map_LineStyle;
148  interface_enum_map_t enum_map_Anchor;
149  public:
150  AddCartCircleMessage(const float ini_x, const float ini_y, const float ini_radius, const LineStyle ini_style, const uint8_t * ini_color);
153 
155  /* Methods */
156  float x() const;
157  void set_x(const float new_x);
158  size_t maxlenof_x() const;
159  float y() const;
160  void set_y(const float new_y);
161  size_t maxlenof_y() const;
162  float radius() const;
163  void set_radius(const float new_radius);
164  size_t maxlenof_radius() const;
165  LineStyle style() const;
166  void set_style(const LineStyle new_style);
167  size_t maxlenof_style() const;
168  uint8_t * color() const;
169  uint8_t color(unsigned int index) const;
170  void set_color(unsigned int index, const uint8_t new_color);
171  void set_color(const uint8_t * new_color);
172  size_t maxlenof_color() const;
173  virtual Message * clone() const;
174  };
175 
177  {
178  private:
179  /** Internal data storage, do NOT modify! */
180  typedef struct __attribute__((packed)) {
181  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
182  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
183  float x; /**< X coordinate of lower right corner */
184  float y; /**< Y coordinate of lower right corner */
185  float width; /**< Width of rectangle */
186  float height; /**< Height of rectangle */
187  int32_t style; /**< Style of this object. */
188  uint8_t color[4]; /**< Color in RGBA */
189  } AddCartRectMessage_data_t;
190 
191  AddCartRectMessage_data_t *data;
192 
193  interface_enum_map_t enum_map_LineStyle;
194  interface_enum_map_t enum_map_Anchor;
195  public:
196  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);
199 
201  /* Methods */
202  float x() const;
203  void set_x(const float new_x);
204  size_t maxlenof_x() const;
205  float y() const;
206  void set_y(const float new_y);
207  size_t maxlenof_y() const;
208  float width() const;
209  void set_width(const float new_width);
210  size_t maxlenof_width() const;
211  float height() const;
212  void set_height(const float new_height);
213  size_t maxlenof_height() const;
214  LineStyle style() const;
215  void set_style(const LineStyle new_style);
216  size_t maxlenof_style() const;
217  uint8_t * color() const;
218  uint8_t color(unsigned int index) const;
219  void set_color(unsigned int index, const uint8_t new_color);
220  void set_color(const uint8_t * new_color);
221  size_t maxlenof_color() const;
222  virtual Message * clone() const;
223  };
224 
226  {
227  private:
228  /** Internal data storage, do NOT modify! */
229  typedef struct __attribute__((packed)) {
230  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
231  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
232  float x; /**< X coordinate of upper left corner */
233  float y; /**< Y coordinate of upper left corner */
234  char text[128]; /**< Width of rectangle */
235  int32_t anchor; /**< Anchor which marks the
236  alignment to the given point. */
237  float size; /**< Font size (max height in m). */
238  uint8_t color[4]; /**< Color in RGBA */
239  } AddCartTextMessage_data_t;
240 
241  AddCartTextMessage_data_t *data;
242 
243  interface_enum_map_t enum_map_LineStyle;
244  interface_enum_map_t enum_map_Anchor;
245  public:
246  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);
249 
251  /* Methods */
252  float x() const;
253  void set_x(const float new_x);
254  size_t maxlenof_x() const;
255  float y() const;
256  void set_y(const float new_y);
257  size_t maxlenof_y() const;
258  char * text() const;
259  void set_text(const char * new_text);
260  size_t maxlenof_text() const;
261  Anchor anchor() const;
262  void set_anchor(const Anchor new_anchor);
263  size_t maxlenof_anchor() const;
264  float size() const;
265  void set_size(const float new_size);
266  size_t maxlenof_size() const;
267  uint8_t * color() const;
268  uint8_t color(unsigned int index) const;
269  void set_color(unsigned int index, const uint8_t new_color);
270  void set_color(const uint8_t * new_color);
271  size_t maxlenof_color() const;
272  virtual Message * clone() const;
273  };
274 
276  {
277  private:
278  /** Internal data storage, do NOT modify! */
279  typedef struct __attribute__((packed)) {
280  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
281  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
282  uint32_t object_id; /**< Object ID, which is
283  the message ID of the Add* message. */
284  } DeleteObjectMessage_data_t;
285 
286  DeleteObjectMessage_data_t *data;
287 
288  interface_enum_map_t enum_map_LineStyle;
289  interface_enum_map_t enum_map_Anchor;
290  public:
291  DeleteObjectMessage(const uint32_t ini_object_id);
294 
296  /* Methods */
297  uint32_t object_id() const;
298  void set_object_id(const uint32_t new_object_id);
299  size_t maxlenof_object_id() const;
300  virtual Message * clone() const;
301  };
302 
303  class DeleteAllMessage : public Message
304  {
305  private:
306  /** Internal data storage, do NOT modify! */
307  typedef struct __attribute__((packed)) {
308  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
309  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
310  } DeleteAllMessage_data_t;
311 
312  DeleteAllMessage_data_t *data;
313 
314  interface_enum_map_t enum_map_LineStyle;
315  interface_enum_map_t enum_map_Anchor;
316  public:
318  ~DeleteAllMessage();
319 
321  /* Methods */
322  virtual Message * clone() const;
323  };
324 
325  virtual bool message_valid(const Message *message) const;
326  private:
329 
330  public:
331  /* Methods */
332  uint32_t counter() const;
333  void set_counter(const uint32_t new_counter);
334  size_t maxlenof_counter() const;
335  virtual Message * create_message(const char *type) const;
336 
337  virtual void copy_values(const Interface *other);
338  virtual const char * enum_tostring(const char *enumtype, int val) const;
339 
340 };
341 
342 } // end namespace fawkes
343 
344 #endif
AddCartRectMessage Fawkes BlackBoard Interface Message.
LineStyle
Enumeration defining the possible line styles.
size_t maxlenof_counter() const
Get maximum length of counter value.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
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.
AddCartCircleMessage Fawkes BlackBoard Interface Message.
Anchor
Enumeration defining the possible anchor points.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
AddCartTextMessage Fawkes BlackBoard Interface Message.
uint32_t counter() const
Get counter value.
DeleteObjectMessage Fawkes BlackBoard Interface Message.
const char * type() const
Get type of interface.
Definition: interface.cpp:651
AddCartLineMessage Fawkes BlackBoard Interface Message.
virtual void copy_values(const Interface *other)
Copy values from other interface.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
Vertically and horitontally centered.
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.
VisualDisplay2DInterface Fawkes BlackBoard Interface.
std::map< int, std::string > interface_enum_map_t
Map of enum integer to string values.
Definition: types.h:53
void set_counter(const uint32_t new_counter)
Set counter value.