Fawkes API  Fawkes Development Version
FacialExpressionInterface.cpp
1 
2 /***************************************************************************
3  * FacialExpressionInterface.cpp - Fawkes BlackBoard Interface - FacialExpressionInterface
4  *
5  * Templated created: Thu Oct 12 10:49:19 2006
6  * Copyright 2009 Bahram Maleki-Fard
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/FacialExpressionInterface.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 FacialExpressionInterface <interfaces/FacialExpressionInterface.h>
36  * FacialExpressionInterface Fawkes BlackBoard Interface.
37  *
38  Interface to acces facial expressions on display (RCSoft)
39 
40  * @ingroup FawkesInterfaces
41  */
42 
43 
44 
45 /** Constructor */
46 FacialExpressionInterface::FacialExpressionInterface() : Interface()
47 {
48  data_size = sizeof(FacialExpressionInterface_data_t);
49  data_ptr = malloc(data_size);
50  data = (FacialExpressionInterface_data_t *)data_ptr;
51  data_ts = (interface_data_ts_t *)data_ptr;
52  memset(data_ptr, 0, data_size);
53  enum_map_brows_t[(int)BROWS_DEFAULT] = "BROWS_DEFAULT";
54  enum_map_brows_t[(int)BROWS_FROWN] = "BROWS_FROWN";
55  enum_map_brows_t[(int)BROWS_LIFT] = "BROWS_LIFT";
56  enum_map_eyes_t[(int)EYES_DEFAULT] = "EYES_DEFAULT";
57  enum_map_eyes_t[(int)EYES_UP] = "EYES_UP";
58  enum_map_eyes_t[(int)EYES_DOWN] = "EYES_DOWN";
59  enum_map_eyes_t[(int)EYES_LEFT] = "EYES_LEFT";
60  enum_map_eyes_t[(int)EYES_RIGHT] = "EYES_RIGHT";
61  enum_map_eyes_t[(int)EYES_COOL] = "EYES_COOL";
62  enum_map_eyes_t[(int)EYES_CROSS] = "EYES_CROSS";
63  enum_map_eyes_t[(int)EYES_HEART] = "EYES_HEART";
64  enum_map_eyes_t[(int)EYES_DOLLAR] = "EYES_DOLLAR";
65  enum_map_jowl_t[(int)JOWL_DEFAULT] = "JOWL_DEFAULT";
66  enum_map_jowl_t[(int)JOWL_BLUSH] = "JOWL_BLUSH";
67  enum_map_jowl_t[(int)JOWL_TEARS] = "JOWL_TEARS";
68  enum_map_mouth_t[(int)MOUTH_DEFAULT] = "MOUTH_DEFAULT";
69  enum_map_mouth_t[(int)MOUTH_OPEN] = "MOUTH_OPEN";
70  enum_map_mouth_t[(int)MOUTH_CLOSE] = "MOUTH_CLOSE";
71  enum_map_mouth_t[(int)MOUTH_SMILE] = "MOUTH_SMILE";
72  enum_map_mouth_t[(int)MOUTH_SCOWL] = "MOUTH_SCOWL";
73  add_fieldinfo(IFT_ENUM, "brows_action", 1, &data->brows_action, "brows_t", &enum_map_brows_t);
74  add_fieldinfo(IFT_ENUM, "eyes_action", 1, &data->eyes_action, "eyes_t", &enum_map_eyes_t);
75  add_fieldinfo(IFT_ENUM, "jowl_action", 1, &data->jowl_action, "jowl_t", &enum_map_jowl_t);
76  add_fieldinfo(IFT_ENUM, "mouth_action", 1, &data->mouth_action, "mouth_t", &enum_map_mouth_t);
77  add_messageinfo("MoveBrowsMessage");
78  add_messageinfo("MoveEyesMessage");
79  add_messageinfo("MoveJowlMessage");
80  add_messageinfo("MoveMouthMessage");
81  unsigned char tmp_hash[] = {0x1, 0xbd, 0xc6, 0x65, 0xb3, 0x10, 0xcb, 0x5f, 0xe8, 0x78, 0xdd, 0x6, 0xe, 0x82, 0x7f, 0x80};
82  set_hash(tmp_hash);
83 }
84 
85 /** Destructor */
86 FacialExpressionInterface::~FacialExpressionInterface()
87 {
88  free(data_ptr);
89 }
90 /** Convert brows_t constant to string.
91  * @param value value to convert to string
92  * @return constant value as string.
93  */
94 const char *
96 {
97  switch (value) {
98  case BROWS_DEFAULT: return "BROWS_DEFAULT";
99  case BROWS_FROWN: return "BROWS_FROWN";
100  case BROWS_LIFT: return "BROWS_LIFT";
101  default: return "UNKNOWN";
102  }
103 }
104 /** Convert eyes_t constant to string.
105  * @param value value to convert to string
106  * @return constant value as string.
107  */
108 const char *
110 {
111  switch (value) {
112  case EYES_DEFAULT: return "EYES_DEFAULT";
113  case EYES_UP: return "EYES_UP";
114  case EYES_DOWN: return "EYES_DOWN";
115  case EYES_LEFT: return "EYES_LEFT";
116  case EYES_RIGHT: return "EYES_RIGHT";
117  case EYES_COOL: return "EYES_COOL";
118  case EYES_CROSS: return "EYES_CROSS";
119  case EYES_HEART: return "EYES_HEART";
120  case EYES_DOLLAR: return "EYES_DOLLAR";
121  default: return "UNKNOWN";
122  }
123 }
124 /** Convert jowl_t constant to string.
125  * @param value value to convert to string
126  * @return constant value as string.
127  */
128 const char *
130 {
131  switch (value) {
132  case JOWL_DEFAULT: return "JOWL_DEFAULT";
133  case JOWL_BLUSH: return "JOWL_BLUSH";
134  case JOWL_TEARS: return "JOWL_TEARS";
135  default: return "UNKNOWN";
136  }
137 }
138 /** Convert mouth_t constant to string.
139  * @param value value to convert to string
140  * @return constant value as string.
141  */
142 const char *
144 {
145  switch (value) {
146  case MOUTH_DEFAULT: return "MOUTH_DEFAULT";
147  case MOUTH_OPEN: return "MOUTH_OPEN";
148  case MOUTH_CLOSE: return "MOUTH_CLOSE";
149  case MOUTH_SMILE: return "MOUTH_SMILE";
150  case MOUTH_SCOWL: return "MOUTH_SCOWL";
151  default: return "UNKNOWN";
152  }
153 }
154 /* Methods */
155 /** Get brows_action value.
156  * Type of action of brows
157  * @return brows_action value
158  */
161 {
162  return (FacialExpressionInterface::brows_t)data->brows_action;
163 }
164 
165 /** Get maximum length of brows_action value.
166  * @return length of brows_action value, can be length of the array or number of
167  * maximum number of characters for a string
168  */
169 size_t
171 {
172  return 1;
173 }
174 
175 /** Set brows_action value.
176  * Type of action of brows
177  * @param new_brows_action new brows_action value
178  */
179 void
181 {
182  data->brows_action = new_brows_action;
183  data_changed = true;
184 }
185 
186 /** Get eyes_action value.
187  * Type of action of eyes
188  * @return eyes_action value
189  */
192 {
193  return (FacialExpressionInterface::eyes_t)data->eyes_action;
194 }
195 
196 /** Get maximum length of eyes_action value.
197  * @return length of eyes_action value, can be length of the array or number of
198  * maximum number of characters for a string
199  */
200 size_t
202 {
203  return 1;
204 }
205 
206 /** Set eyes_action value.
207  * Type of action of eyes
208  * @param new_eyes_action new eyes_action value
209  */
210 void
212 {
213  data->eyes_action = new_eyes_action;
214  data_changed = true;
215 }
216 
217 /** Get jowl_action value.
218  * Type of action of jown
219  * @return jowl_action value
220  */
223 {
224  return (FacialExpressionInterface::jowl_t)data->jowl_action;
225 }
226 
227 /** Get maximum length of jowl_action value.
228  * @return length of jowl_action value, can be length of the array or number of
229  * maximum number of characters for a string
230  */
231 size_t
233 {
234  return 1;
235 }
236 
237 /** Set jowl_action value.
238  * Type of action of jown
239  * @param new_jowl_action new jowl_action value
240  */
241 void
243 {
244  data->jowl_action = new_jowl_action;
245  data_changed = true;
246 }
247 
248 /** Get mouth_action value.
249  * Type of action of mouth
250  * @return mouth_action value
251  */
254 {
255  return (FacialExpressionInterface::mouth_t)data->mouth_action;
256 }
257 
258 /** Get maximum length of mouth_action value.
259  * @return length of mouth_action value, can be length of the array or number of
260  * maximum number of characters for a string
261  */
262 size_t
264 {
265  return 1;
266 }
267 
268 /** Set mouth_action value.
269  * Type of action of mouth
270  * @param new_mouth_action new mouth_action value
271  */
272 void
274 {
275  data->mouth_action = new_mouth_action;
276  data_changed = true;
277 }
278 
279 /* =========== message create =========== */
280 Message *
282 {
283  if ( strncmp("MoveBrowsMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
284  return new MoveBrowsMessage();
285  } else if ( strncmp("MoveEyesMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
286  return new MoveEyesMessage();
287  } else if ( strncmp("MoveJowlMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
288  return new MoveJowlMessage();
289  } else if ( strncmp("MoveMouthMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
290  return new MoveMouthMessage();
291  } else {
292  throw UnknownTypeException("The given type '%s' does not match any known "
293  "message type for this interface type.", type);
294  }
295 }
296 
297 
298 /** Copy values from other interface.
299  * @param other other interface to copy values from
300  */
301 void
303 {
304  const FacialExpressionInterface *oi = dynamic_cast<const FacialExpressionInterface *>(other);
305  if (oi == NULL) {
306  throw TypeMismatchException("Can only copy values from interface of same type (%s vs. %s)",
307  type(), other->type());
308  }
309  memcpy(data, oi->data, sizeof(FacialExpressionInterface_data_t));
310 }
311 
312 const char *
313 FacialExpressionInterface::enum_tostring(const char *enumtype, int val) const
314 {
315  if (strcmp(enumtype, "brows_t") == 0) {
316  return tostring_brows_t((brows_t)val);
317  }
318  if (strcmp(enumtype, "eyes_t") == 0) {
319  return tostring_eyes_t((eyes_t)val);
320  }
321  if (strcmp(enumtype, "jowl_t") == 0) {
322  return tostring_jowl_t((jowl_t)val);
323  }
324  if (strcmp(enumtype, "mouth_t") == 0) {
325  return tostring_mouth_t((mouth_t)val);
326  }
327  throw UnknownTypeException("Unknown enum type %s", enumtype);
328 }
329 
330 /* =========== messages =========== */
331 /** @class FacialExpressionInterface::MoveBrowsMessage <interfaces/FacialExpressionInterface.h>
332  * MoveBrowsMessage Fawkes BlackBoard Interface Message.
333  *
334 
335  */
336 
337 
338 /** Constructor with initial values.
339  * @param ini_brows_action initial value for brows_action
340  */
342 {
343  data_size = sizeof(MoveBrowsMessage_data_t);
344  data_ptr = malloc(data_size);
345  memset(data_ptr, 0, data_size);
346  data = (MoveBrowsMessage_data_t *)data_ptr;
348  data->brows_action = ini_brows_action;
349  enum_map_brows_t[(int)BROWS_DEFAULT] = "BROWS_DEFAULT";
350  enum_map_brows_t[(int)BROWS_FROWN] = "BROWS_FROWN";
351  enum_map_brows_t[(int)BROWS_LIFT] = "BROWS_LIFT";
352  enum_map_eyes_t[(int)EYES_DEFAULT] = "EYES_DEFAULT";
353  enum_map_eyes_t[(int)EYES_UP] = "EYES_UP";
354  enum_map_eyes_t[(int)EYES_DOWN] = "EYES_DOWN";
355  enum_map_eyes_t[(int)EYES_LEFT] = "EYES_LEFT";
356  enum_map_eyes_t[(int)EYES_RIGHT] = "EYES_RIGHT";
357  enum_map_eyes_t[(int)EYES_COOL] = "EYES_COOL";
358  enum_map_eyes_t[(int)EYES_CROSS] = "EYES_CROSS";
359  enum_map_eyes_t[(int)EYES_HEART] = "EYES_HEART";
360  enum_map_eyes_t[(int)EYES_DOLLAR] = "EYES_DOLLAR";
361  enum_map_jowl_t[(int)JOWL_DEFAULT] = "JOWL_DEFAULT";
362  enum_map_jowl_t[(int)JOWL_BLUSH] = "JOWL_BLUSH";
363  enum_map_jowl_t[(int)JOWL_TEARS] = "JOWL_TEARS";
364  enum_map_mouth_t[(int)MOUTH_DEFAULT] = "MOUTH_DEFAULT";
365  enum_map_mouth_t[(int)MOUTH_OPEN] = "MOUTH_OPEN";
366  enum_map_mouth_t[(int)MOUTH_CLOSE] = "MOUTH_CLOSE";
367  enum_map_mouth_t[(int)MOUTH_SMILE] = "MOUTH_SMILE";
368  enum_map_mouth_t[(int)MOUTH_SCOWL] = "MOUTH_SCOWL";
369  add_fieldinfo(IFT_ENUM, "brows_action", 1, &data->brows_action, "brows_t", &enum_map_brows_t);
370 }
371 /** Constructor */
373 {
374  data_size = sizeof(MoveBrowsMessage_data_t);
375  data_ptr = malloc(data_size);
376  memset(data_ptr, 0, data_size);
377  data = (MoveBrowsMessage_data_t *)data_ptr;
379  enum_map_brows_t[(int)BROWS_DEFAULT] = "BROWS_DEFAULT";
380  enum_map_brows_t[(int)BROWS_FROWN] = "BROWS_FROWN";
381  enum_map_brows_t[(int)BROWS_LIFT] = "BROWS_LIFT";
382  enum_map_eyes_t[(int)EYES_DEFAULT] = "EYES_DEFAULT";
383  enum_map_eyes_t[(int)EYES_UP] = "EYES_UP";
384  enum_map_eyes_t[(int)EYES_DOWN] = "EYES_DOWN";
385  enum_map_eyes_t[(int)EYES_LEFT] = "EYES_LEFT";
386  enum_map_eyes_t[(int)EYES_RIGHT] = "EYES_RIGHT";
387  enum_map_eyes_t[(int)EYES_COOL] = "EYES_COOL";
388  enum_map_eyes_t[(int)EYES_CROSS] = "EYES_CROSS";
389  enum_map_eyes_t[(int)EYES_HEART] = "EYES_HEART";
390  enum_map_eyes_t[(int)EYES_DOLLAR] = "EYES_DOLLAR";
391  enum_map_jowl_t[(int)JOWL_DEFAULT] = "JOWL_DEFAULT";
392  enum_map_jowl_t[(int)JOWL_BLUSH] = "JOWL_BLUSH";
393  enum_map_jowl_t[(int)JOWL_TEARS] = "JOWL_TEARS";
394  enum_map_mouth_t[(int)MOUTH_DEFAULT] = "MOUTH_DEFAULT";
395  enum_map_mouth_t[(int)MOUTH_OPEN] = "MOUTH_OPEN";
396  enum_map_mouth_t[(int)MOUTH_CLOSE] = "MOUTH_CLOSE";
397  enum_map_mouth_t[(int)MOUTH_SMILE] = "MOUTH_SMILE";
398  enum_map_mouth_t[(int)MOUTH_SCOWL] = "MOUTH_SCOWL";
399  add_fieldinfo(IFT_ENUM, "brows_action", 1, &data->brows_action, "brows_t", &enum_map_brows_t);
400 }
401 
402 /** Destructor */
404 {
405  free(data_ptr);
406 }
407 
408 /** Copy constructor.
409  * @param m message to copy from
410  */
412 {
413  data_size = m->data_size;
414  data_ptr = malloc(data_size);
415  memcpy(data_ptr, m->data_ptr, data_size);
416  data = (MoveBrowsMessage_data_t *)data_ptr;
418 }
419 
420 /* Methods */
421 /** Get brows_action value.
422  * Type of action of brows
423  * @return brows_action value
424  */
427 {
428  return (FacialExpressionInterface::brows_t)data->brows_action;
429 }
430 
431 /** Get maximum length of brows_action value.
432  * @return length of brows_action value, can be length of the array or number of
433  * maximum number of characters for a string
434  */
435 size_t
437 {
438  return 1;
439 }
440 
441 /** Set brows_action value.
442  * Type of action of brows
443  * @param new_brows_action new brows_action value
444  */
445 void
447 {
448  data->brows_action = new_brows_action;
449 }
450 
451 /** Clone this message.
452  * Produces a message of the same type as this message and copies the
453  * data to the new message.
454  * @return clone of this message
455  */
456 Message *
458 {
460 }
461 /** @class FacialExpressionInterface::MoveEyesMessage <interfaces/FacialExpressionInterface.h>
462  * MoveEyesMessage Fawkes BlackBoard Interface Message.
463  *
464 
465  */
466 
467 
468 /** Constructor with initial values.
469  * @param ini_eyes_action initial value for eyes_action
470  */
472 {
473  data_size = sizeof(MoveEyesMessage_data_t);
474  data_ptr = malloc(data_size);
475  memset(data_ptr, 0, data_size);
476  data = (MoveEyesMessage_data_t *)data_ptr;
478  data->eyes_action = ini_eyes_action;
479  enum_map_brows_t[(int)BROWS_DEFAULT] = "BROWS_DEFAULT";
480  enum_map_brows_t[(int)BROWS_FROWN] = "BROWS_FROWN";
481  enum_map_brows_t[(int)BROWS_LIFT] = "BROWS_LIFT";
482  enum_map_eyes_t[(int)EYES_DEFAULT] = "EYES_DEFAULT";
483  enum_map_eyes_t[(int)EYES_UP] = "EYES_UP";
484  enum_map_eyes_t[(int)EYES_DOWN] = "EYES_DOWN";
485  enum_map_eyes_t[(int)EYES_LEFT] = "EYES_LEFT";
486  enum_map_eyes_t[(int)EYES_RIGHT] = "EYES_RIGHT";
487  enum_map_eyes_t[(int)EYES_COOL] = "EYES_COOL";
488  enum_map_eyes_t[(int)EYES_CROSS] = "EYES_CROSS";
489  enum_map_eyes_t[(int)EYES_HEART] = "EYES_HEART";
490  enum_map_eyes_t[(int)EYES_DOLLAR] = "EYES_DOLLAR";
491  enum_map_jowl_t[(int)JOWL_DEFAULT] = "JOWL_DEFAULT";
492  enum_map_jowl_t[(int)JOWL_BLUSH] = "JOWL_BLUSH";
493  enum_map_jowl_t[(int)JOWL_TEARS] = "JOWL_TEARS";
494  enum_map_mouth_t[(int)MOUTH_DEFAULT] = "MOUTH_DEFAULT";
495  enum_map_mouth_t[(int)MOUTH_OPEN] = "MOUTH_OPEN";
496  enum_map_mouth_t[(int)MOUTH_CLOSE] = "MOUTH_CLOSE";
497  enum_map_mouth_t[(int)MOUTH_SMILE] = "MOUTH_SMILE";
498  enum_map_mouth_t[(int)MOUTH_SCOWL] = "MOUTH_SCOWL";
499  add_fieldinfo(IFT_ENUM, "eyes_action", 1, &data->eyes_action, "eyes_t", &enum_map_eyes_t);
500 }
501 /** Constructor */
503 {
504  data_size = sizeof(MoveEyesMessage_data_t);
505  data_ptr = malloc(data_size);
506  memset(data_ptr, 0, data_size);
507  data = (MoveEyesMessage_data_t *)data_ptr;
509  enum_map_brows_t[(int)BROWS_DEFAULT] = "BROWS_DEFAULT";
510  enum_map_brows_t[(int)BROWS_FROWN] = "BROWS_FROWN";
511  enum_map_brows_t[(int)BROWS_LIFT] = "BROWS_LIFT";
512  enum_map_eyes_t[(int)EYES_DEFAULT] = "EYES_DEFAULT";
513  enum_map_eyes_t[(int)EYES_UP] = "EYES_UP";
514  enum_map_eyes_t[(int)EYES_DOWN] = "EYES_DOWN";
515  enum_map_eyes_t[(int)EYES_LEFT] = "EYES_LEFT";
516  enum_map_eyes_t[(int)EYES_RIGHT] = "EYES_RIGHT";
517  enum_map_eyes_t[(int)EYES_COOL] = "EYES_COOL";
518  enum_map_eyes_t[(int)EYES_CROSS] = "EYES_CROSS";
519  enum_map_eyes_t[(int)EYES_HEART] = "EYES_HEART";
520  enum_map_eyes_t[(int)EYES_DOLLAR] = "EYES_DOLLAR";
521  enum_map_jowl_t[(int)JOWL_DEFAULT] = "JOWL_DEFAULT";
522  enum_map_jowl_t[(int)JOWL_BLUSH] = "JOWL_BLUSH";
523  enum_map_jowl_t[(int)JOWL_TEARS] = "JOWL_TEARS";
524  enum_map_mouth_t[(int)MOUTH_DEFAULT] = "MOUTH_DEFAULT";
525  enum_map_mouth_t[(int)MOUTH_OPEN] = "MOUTH_OPEN";
526  enum_map_mouth_t[(int)MOUTH_CLOSE] = "MOUTH_CLOSE";
527  enum_map_mouth_t[(int)MOUTH_SMILE] = "MOUTH_SMILE";
528  enum_map_mouth_t[(int)MOUTH_SCOWL] = "MOUTH_SCOWL";
529  add_fieldinfo(IFT_ENUM, "eyes_action", 1, &data->eyes_action, "eyes_t", &enum_map_eyes_t);
530 }
531 
532 /** Destructor */
534 {
535  free(data_ptr);
536 }
537 
538 /** Copy constructor.
539  * @param m message to copy from
540  */
542 {
543  data_size = m->data_size;
544  data_ptr = malloc(data_size);
545  memcpy(data_ptr, m->data_ptr, data_size);
546  data = (MoveEyesMessage_data_t *)data_ptr;
548 }
549 
550 /* Methods */
551 /** Get eyes_action value.
552  * Type of action of eyes
553  * @return eyes_action value
554  */
557 {
558  return (FacialExpressionInterface::eyes_t)data->eyes_action;
559 }
560 
561 /** Get maximum length of eyes_action value.
562  * @return length of eyes_action value, can be length of the array or number of
563  * maximum number of characters for a string
564  */
565 size_t
567 {
568  return 1;
569 }
570 
571 /** Set eyes_action value.
572  * Type of action of eyes
573  * @param new_eyes_action new eyes_action value
574  */
575 void
577 {
578  data->eyes_action = new_eyes_action;
579 }
580 
581 /** Clone this message.
582  * Produces a message of the same type as this message and copies the
583  * data to the new message.
584  * @return clone of this message
585  */
586 Message *
588 {
590 }
591 /** @class FacialExpressionInterface::MoveJowlMessage <interfaces/FacialExpressionInterface.h>
592  * MoveJowlMessage Fawkes BlackBoard Interface Message.
593  *
594 
595  */
596 
597 
598 /** Constructor with initial values.
599  * @param ini_jowl_action initial value for jowl_action
600  */
602 {
603  data_size = sizeof(MoveJowlMessage_data_t);
604  data_ptr = malloc(data_size);
605  memset(data_ptr, 0, data_size);
606  data = (MoveJowlMessage_data_t *)data_ptr;
608  data->jowl_action = ini_jowl_action;
609  enum_map_brows_t[(int)BROWS_DEFAULT] = "BROWS_DEFAULT";
610  enum_map_brows_t[(int)BROWS_FROWN] = "BROWS_FROWN";
611  enum_map_brows_t[(int)BROWS_LIFT] = "BROWS_LIFT";
612  enum_map_eyes_t[(int)EYES_DEFAULT] = "EYES_DEFAULT";
613  enum_map_eyes_t[(int)EYES_UP] = "EYES_UP";
614  enum_map_eyes_t[(int)EYES_DOWN] = "EYES_DOWN";
615  enum_map_eyes_t[(int)EYES_LEFT] = "EYES_LEFT";
616  enum_map_eyes_t[(int)EYES_RIGHT] = "EYES_RIGHT";
617  enum_map_eyes_t[(int)EYES_COOL] = "EYES_COOL";
618  enum_map_eyes_t[(int)EYES_CROSS] = "EYES_CROSS";
619  enum_map_eyes_t[(int)EYES_HEART] = "EYES_HEART";
620  enum_map_eyes_t[(int)EYES_DOLLAR] = "EYES_DOLLAR";
621  enum_map_jowl_t[(int)JOWL_DEFAULT] = "JOWL_DEFAULT";
622  enum_map_jowl_t[(int)JOWL_BLUSH] = "JOWL_BLUSH";
623  enum_map_jowl_t[(int)JOWL_TEARS] = "JOWL_TEARS";
624  enum_map_mouth_t[(int)MOUTH_DEFAULT] = "MOUTH_DEFAULT";
625  enum_map_mouth_t[(int)MOUTH_OPEN] = "MOUTH_OPEN";
626  enum_map_mouth_t[(int)MOUTH_CLOSE] = "MOUTH_CLOSE";
627  enum_map_mouth_t[(int)MOUTH_SMILE] = "MOUTH_SMILE";
628  enum_map_mouth_t[(int)MOUTH_SCOWL] = "MOUTH_SCOWL";
629  add_fieldinfo(IFT_ENUM, "jowl_action", 1, &data->jowl_action, "jowl_t", &enum_map_jowl_t);
630 }
631 /** Constructor */
633 {
634  data_size = sizeof(MoveJowlMessage_data_t);
635  data_ptr = malloc(data_size);
636  memset(data_ptr, 0, data_size);
637  data = (MoveJowlMessage_data_t *)data_ptr;
639  enum_map_brows_t[(int)BROWS_DEFAULT] = "BROWS_DEFAULT";
640  enum_map_brows_t[(int)BROWS_FROWN] = "BROWS_FROWN";
641  enum_map_brows_t[(int)BROWS_LIFT] = "BROWS_LIFT";
642  enum_map_eyes_t[(int)EYES_DEFAULT] = "EYES_DEFAULT";
643  enum_map_eyes_t[(int)EYES_UP] = "EYES_UP";
644  enum_map_eyes_t[(int)EYES_DOWN] = "EYES_DOWN";
645  enum_map_eyes_t[(int)EYES_LEFT] = "EYES_LEFT";
646  enum_map_eyes_t[(int)EYES_RIGHT] = "EYES_RIGHT";
647  enum_map_eyes_t[(int)EYES_COOL] = "EYES_COOL";
648  enum_map_eyes_t[(int)EYES_CROSS] = "EYES_CROSS";
649  enum_map_eyes_t[(int)EYES_HEART] = "EYES_HEART";
650  enum_map_eyes_t[(int)EYES_DOLLAR] = "EYES_DOLLAR";
651  enum_map_jowl_t[(int)JOWL_DEFAULT] = "JOWL_DEFAULT";
652  enum_map_jowl_t[(int)JOWL_BLUSH] = "JOWL_BLUSH";
653  enum_map_jowl_t[(int)JOWL_TEARS] = "JOWL_TEARS";
654  enum_map_mouth_t[(int)MOUTH_DEFAULT] = "MOUTH_DEFAULT";
655  enum_map_mouth_t[(int)MOUTH_OPEN] = "MOUTH_OPEN";
656  enum_map_mouth_t[(int)MOUTH_CLOSE] = "MOUTH_CLOSE";
657  enum_map_mouth_t[(int)MOUTH_SMILE] = "MOUTH_SMILE";
658  enum_map_mouth_t[(int)MOUTH_SCOWL] = "MOUTH_SCOWL";
659  add_fieldinfo(IFT_ENUM, "jowl_action", 1, &data->jowl_action, "jowl_t", &enum_map_jowl_t);
660 }
661 
662 /** Destructor */
664 {
665  free(data_ptr);
666 }
667 
668 /** Copy constructor.
669  * @param m message to copy from
670  */
672 {
673  data_size = m->data_size;
674  data_ptr = malloc(data_size);
675  memcpy(data_ptr, m->data_ptr, data_size);
676  data = (MoveJowlMessage_data_t *)data_ptr;
678 }
679 
680 /* Methods */
681 /** Get jowl_action value.
682  * Type of action of jown
683  * @return jowl_action value
684  */
687 {
688  return (FacialExpressionInterface::jowl_t)data->jowl_action;
689 }
690 
691 /** Get maximum length of jowl_action value.
692  * @return length of jowl_action value, can be length of the array or number of
693  * maximum number of characters for a string
694  */
695 size_t
697 {
698  return 1;
699 }
700 
701 /** Set jowl_action value.
702  * Type of action of jown
703  * @param new_jowl_action new jowl_action value
704  */
705 void
707 {
708  data->jowl_action = new_jowl_action;
709 }
710 
711 /** Clone this message.
712  * Produces a message of the same type as this message and copies the
713  * data to the new message.
714  * @return clone of this message
715  */
716 Message *
718 {
720 }
721 /** @class FacialExpressionInterface::MoveMouthMessage <interfaces/FacialExpressionInterface.h>
722  * MoveMouthMessage Fawkes BlackBoard Interface Message.
723  *
724 
725  */
726 
727 
728 /** Constructor with initial values.
729  * @param ini_mouth_action initial value for mouth_action
730  */
732 {
733  data_size = sizeof(MoveMouthMessage_data_t);
734  data_ptr = malloc(data_size);
735  memset(data_ptr, 0, data_size);
736  data = (MoveMouthMessage_data_t *)data_ptr;
738  data->mouth_action = ini_mouth_action;
739  enum_map_brows_t[(int)BROWS_DEFAULT] = "BROWS_DEFAULT";
740  enum_map_brows_t[(int)BROWS_FROWN] = "BROWS_FROWN";
741  enum_map_brows_t[(int)BROWS_LIFT] = "BROWS_LIFT";
742  enum_map_eyes_t[(int)EYES_DEFAULT] = "EYES_DEFAULT";
743  enum_map_eyes_t[(int)EYES_UP] = "EYES_UP";
744  enum_map_eyes_t[(int)EYES_DOWN] = "EYES_DOWN";
745  enum_map_eyes_t[(int)EYES_LEFT] = "EYES_LEFT";
746  enum_map_eyes_t[(int)EYES_RIGHT] = "EYES_RIGHT";
747  enum_map_eyes_t[(int)EYES_COOL] = "EYES_COOL";
748  enum_map_eyes_t[(int)EYES_CROSS] = "EYES_CROSS";
749  enum_map_eyes_t[(int)EYES_HEART] = "EYES_HEART";
750  enum_map_eyes_t[(int)EYES_DOLLAR] = "EYES_DOLLAR";
751  enum_map_jowl_t[(int)JOWL_DEFAULT] = "JOWL_DEFAULT";
752  enum_map_jowl_t[(int)JOWL_BLUSH] = "JOWL_BLUSH";
753  enum_map_jowl_t[(int)JOWL_TEARS] = "JOWL_TEARS";
754  enum_map_mouth_t[(int)MOUTH_DEFAULT] = "MOUTH_DEFAULT";
755  enum_map_mouth_t[(int)MOUTH_OPEN] = "MOUTH_OPEN";
756  enum_map_mouth_t[(int)MOUTH_CLOSE] = "MOUTH_CLOSE";
757  enum_map_mouth_t[(int)MOUTH_SMILE] = "MOUTH_SMILE";
758  enum_map_mouth_t[(int)MOUTH_SCOWL] = "MOUTH_SCOWL";
759  add_fieldinfo(IFT_ENUM, "mouth_action", 1, &data->mouth_action, "mouth_t", &enum_map_mouth_t);
760 }
761 /** Constructor */
763 {
764  data_size = sizeof(MoveMouthMessage_data_t);
765  data_ptr = malloc(data_size);
766  memset(data_ptr, 0, data_size);
767  data = (MoveMouthMessage_data_t *)data_ptr;
769  enum_map_brows_t[(int)BROWS_DEFAULT] = "BROWS_DEFAULT";
770  enum_map_brows_t[(int)BROWS_FROWN] = "BROWS_FROWN";
771  enum_map_brows_t[(int)BROWS_LIFT] = "BROWS_LIFT";
772  enum_map_eyes_t[(int)EYES_DEFAULT] = "EYES_DEFAULT";
773  enum_map_eyes_t[(int)EYES_UP] = "EYES_UP";
774  enum_map_eyes_t[(int)EYES_DOWN] = "EYES_DOWN";
775  enum_map_eyes_t[(int)EYES_LEFT] = "EYES_LEFT";
776  enum_map_eyes_t[(int)EYES_RIGHT] = "EYES_RIGHT";
777  enum_map_eyes_t[(int)EYES_COOL] = "EYES_COOL";
778  enum_map_eyes_t[(int)EYES_CROSS] = "EYES_CROSS";
779  enum_map_eyes_t[(int)EYES_HEART] = "EYES_HEART";
780  enum_map_eyes_t[(int)EYES_DOLLAR] = "EYES_DOLLAR";
781  enum_map_jowl_t[(int)JOWL_DEFAULT] = "JOWL_DEFAULT";
782  enum_map_jowl_t[(int)JOWL_BLUSH] = "JOWL_BLUSH";
783  enum_map_jowl_t[(int)JOWL_TEARS] = "JOWL_TEARS";
784  enum_map_mouth_t[(int)MOUTH_DEFAULT] = "MOUTH_DEFAULT";
785  enum_map_mouth_t[(int)MOUTH_OPEN] = "MOUTH_OPEN";
786  enum_map_mouth_t[(int)MOUTH_CLOSE] = "MOUTH_CLOSE";
787  enum_map_mouth_t[(int)MOUTH_SMILE] = "MOUTH_SMILE";
788  enum_map_mouth_t[(int)MOUTH_SCOWL] = "MOUTH_SCOWL";
789  add_fieldinfo(IFT_ENUM, "mouth_action", 1, &data->mouth_action, "mouth_t", &enum_map_mouth_t);
790 }
791 
792 /** Destructor */
794 {
795  free(data_ptr);
796 }
797 
798 /** Copy constructor.
799  * @param m message to copy from
800  */
802 {
803  data_size = m->data_size;
804  data_ptr = malloc(data_size);
805  memcpy(data_ptr, m->data_ptr, data_size);
806  data = (MoveMouthMessage_data_t *)data_ptr;
808 }
809 
810 /* Methods */
811 /** Get mouth_action value.
812  * Type of action of mouth
813  * @return mouth_action value
814  */
817 {
818  return (FacialExpressionInterface::mouth_t)data->mouth_action;
819 }
820 
821 /** Get maximum length of mouth_action value.
822  * @return length of mouth_action value, can be length of the array or number of
823  * maximum number of characters for a string
824  */
825 size_t
827 {
828  return 1;
829 }
830 
831 /** Set mouth_action value.
832  * Type of action of mouth
833  * @param new_mouth_action new mouth_action value
834  */
835 void
837 {
838  data->mouth_action = new_mouth_action;
839 }
840 
841 /** Clone this message.
842  * Produces a message of the same type as this message and copies the
843  * data to the new message.
844  * @return clone of this message
845  */
846 Message *
848 {
850 }
851 /** Check if message is valid and can be enqueued.
852  * @param message Message to check
853  * @return true if the message is valid, false otherwise.
854  */
855 bool
857 {
858  const MoveBrowsMessage *m0 = dynamic_cast<const MoveBrowsMessage *>(message);
859  if ( m0 != NULL ) {
860  return true;
861  }
862  const MoveEyesMessage *m1 = dynamic_cast<const MoveEyesMessage *>(message);
863  if ( m1 != NULL ) {
864  return true;
865  }
866  const MoveJowlMessage *m2 = dynamic_cast<const MoveJowlMessage *>(message);
867  if ( m2 != NULL ) {
868  return true;
869  }
870  const MoveMouthMessage *m3 = dynamic_cast<const MoveMouthMessage *>(message);
871  if ( m3 != NULL ) {
872  return true;
873  }
874  return false;
875 }
876 
877 /// @cond INTERNALS
878 EXPORT_INTERFACE(FacialExpressionInterface)
879 /// @endcond
880 
881 
882 } // end namespace fawkes
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
void * data_ptr
Pointer to memory that contains local data.
Definition: message.h:124
void set_eyes_action(const eyes_t new_eyes_action)
Set eyes_action value.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
eyes_t
Action types for moving eyes.
size_t maxlenof_jowl_action() const
Get maximum length of jowl_action value.
const char * tostring_jowl_t(jowl_t value) const
Convert jowl_t constant to string.
MoveEyesMessage Fawkes BlackBoard Interface Message.
virtual Message * clone() const
Clone this message.
void set_hash(unsigned char *ihash)
Set hash.
Definition: interface.cpp:314
size_t maxlenof_mouth_action() const
Get maximum length of mouth_action value.
Fawkes library namespace.
Timestamp data, must be present and first entries for each interface data structs! This leans on time...
Definition: message.h:129
jowl_t jowl_action() const
Get jowl_action value.
size_t maxlenof_eyes_action() const
Get maximum length of eyes_action value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
const char * tostring_eyes_t(eyes_t value) const
Convert eyes_t constant to string.
eyes_t eyes_action() const
Get eyes_action value.
size_t maxlenof_mouth_action() const
Get maximum length of mouth_action value.
void set_jowl_action(const jowl_t new_jowl_action)
Set jowl_action value.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
MoveBrowsMessage Fawkes BlackBoard Interface Message.
mouth_t mouth_action() const
Get mouth_action value.
virtual Message * clone() const
Clone this message.
virtual void copy_values(const Interface *other)
Copy values from other interface.
message_data_ts_t * data_ts
data timestamp aliasing pointer
Definition: message.h:133
unsigned int data_size
Size of memory needed to hold all data.
Definition: message.h:125
void add_messageinfo(const char *name)
Add an entry to the message info list.
Definition: interface.cpp:373
bool data_changed
Indicator if data has changed.
Definition: interface.h:222
MoveJowlMessage Fawkes BlackBoard Interface Message.
const char * type() const
Get type of interface.
Definition: interface.cpp:651
virtual Message * create_message(const char *type) const
Create message based on type name.
void set_jowl_action(const jowl_t new_jowl_action)
Set jowl_action value.
void set_brows_action(const brows_t new_brows_action)
Set brows_action value.
void set_mouth_action(const mouth_t new_mouth_action)
Set mouth_action value.
void set_mouth_action(const mouth_t new_mouth_action)
Set mouth_action value.
size_t maxlenof_eyes_action() const
Get maximum length of eyes_action value.
FacialExpressionInterface Fawkes BlackBoard Interface.
jowl_t
Action types for moving jowl.
mouth_t
Action types for moving mouth.
virtual Message * clone() const
Clone this message.
size_t maxlenof_brows_action() const
Get maximum length of brows_action value.
size_t maxlenof_brows_action() const
Get maximum length of brows_action value.
virtual Message * clone() const
Clone this message.
void set_brows_action(const brows_t new_brows_action)
Set brows_action value.
brows_t brows_action() const
Get brows_action value.
MoveMouthMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_jowl_action() const
Get maximum length of jowl_action value.
void set_eyes_action(const eyes_t new_eyes_action)
Set eyes_action value.
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
brows_t
Action types for moving brows.
const char * type() const
Get message type.
Definition: message.cpp:378
const char * tostring_mouth_t(mouth_t value) const
Convert mouth_t constant to string.
field with interface specific enum type
Definition: types.h:49
const char * tostring_brows_t(brows_t value) const
Convert brows_t constant to string.