Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * FacialExpressionInterface.cpp - Fawkes BlackBoard Interface - FacialExpressionInterface 00004 * 00005 * Templated created: Thu Oct 12 10:49:19 2006 00006 * Copyright 2009 Bahram Maleki-Fard 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #include <interfaces/FacialExpressionInterface.h> 00025 00026 #include <core/exceptions/software.h> 00027 00028 #include <cstring> 00029 #include <cstdlib> 00030 00031 namespace fawkes { 00032 00033 /** @class FacialExpressionInterface <interfaces/FacialExpressionInterface.h> 00034 * FacialExpressionInterface Fawkes BlackBoard Interface. 00035 * 00036 Interface to acces facial expressions on display (RCSoft) 00037 00038 * @ingroup FawkesInterfaces 00039 */ 00040 00041 00042 00043 /** Constructor */ 00044 FacialExpressionInterface::FacialExpressionInterface() : Interface() 00045 { 00046 data_size = sizeof(FacialExpressionInterface_data_t); 00047 data_ptr = malloc(data_size); 00048 data = (FacialExpressionInterface_data_t *)data_ptr; 00049 data_ts = (interface_data_ts_t *)data_ptr; 00050 memset(data_ptr, 0, data_size); 00051 add_fieldinfo(IFT_ENUM, "brows_action", 1, &data->brows_action, "brows_t"); 00052 add_fieldinfo(IFT_ENUM, "eyes_action", 1, &data->eyes_action, "eyes_t"); 00053 add_fieldinfo(IFT_ENUM, "jowl_action", 1, &data->jowl_action, "jowl_t"); 00054 add_fieldinfo(IFT_ENUM, "mouth_action", 1, &data->mouth_action, "mouth_t"); 00055 add_messageinfo("MoveBrowsMessage"); 00056 add_messageinfo("MoveEyesMessage"); 00057 add_messageinfo("MoveJowlMessage"); 00058 add_messageinfo("MoveMouthMessage"); 00059 unsigned char tmp_hash[] = {0x1, 0xbd, 0xc6, 0x65, 0xb3, 0x10, 0xcb, 0x5f, 0xe8, 0x78, 0xdd, 0x6, 0xe, 0x82, 0x7f, 0x80}; 00060 set_hash(tmp_hash); 00061 } 00062 00063 /** Destructor */ 00064 FacialExpressionInterface::~FacialExpressionInterface() 00065 { 00066 free(data_ptr); 00067 } 00068 /** Convert brows_t constant to string. 00069 * @param value value to convert to string 00070 * @return constant value as string. 00071 */ 00072 const char * 00073 FacialExpressionInterface::tostring_brows_t(brows_t value) const 00074 { 00075 switch (value) { 00076 case BROWS_DEFAULT: return "BROWS_DEFAULT"; 00077 case BROWS_FROWN: return "BROWS_FROWN"; 00078 case BROWS_LIFT: return "BROWS_LIFT"; 00079 default: return "UNKNOWN"; 00080 } 00081 } 00082 /** Convert eyes_t constant to string. 00083 * @param value value to convert to string 00084 * @return constant value as string. 00085 */ 00086 const char * 00087 FacialExpressionInterface::tostring_eyes_t(eyes_t value) const 00088 { 00089 switch (value) { 00090 case EYES_DEFAULT: return "EYES_DEFAULT"; 00091 case EYES_UP: return "EYES_UP"; 00092 case EYES_DOWN: return "EYES_DOWN"; 00093 case EYES_LEFT: return "EYES_LEFT"; 00094 case EYES_RIGHT: return "EYES_RIGHT"; 00095 case EYES_COOL: return "EYES_COOL"; 00096 case EYES_CROSS: return "EYES_CROSS"; 00097 case EYES_HEART: return "EYES_HEART"; 00098 case EYES_DOLLAR: return "EYES_DOLLAR"; 00099 default: return "UNKNOWN"; 00100 } 00101 } 00102 /** Convert jowl_t constant to string. 00103 * @param value value to convert to string 00104 * @return constant value as string. 00105 */ 00106 const char * 00107 FacialExpressionInterface::tostring_jowl_t(jowl_t value) const 00108 { 00109 switch (value) { 00110 case JOWL_DEFAULT: return "JOWL_DEFAULT"; 00111 case JOWL_BLUSH: return "JOWL_BLUSH"; 00112 case JOWL_TEARS: return "JOWL_TEARS"; 00113 default: return "UNKNOWN"; 00114 } 00115 } 00116 /** Convert mouth_t constant to string. 00117 * @param value value to convert to string 00118 * @return constant value as string. 00119 */ 00120 const char * 00121 FacialExpressionInterface::tostring_mouth_t(mouth_t value) const 00122 { 00123 switch (value) { 00124 case MOUTH_DEFAULT: return "MOUTH_DEFAULT"; 00125 case MOUTH_OPEN: return "MOUTH_OPEN"; 00126 case MOUTH_CLOSE: return "MOUTH_CLOSE"; 00127 case MOUTH_SMILE: return "MOUTH_SMILE"; 00128 case MOUTH_SCOWL: return "MOUTH_SCOWL"; 00129 default: return "UNKNOWN"; 00130 } 00131 } 00132 /* Methods */ 00133 /** Get brows_action value. 00134 * Type of action of brows 00135 * @return brows_action value 00136 */ 00137 FacialExpressionInterface::brows_t 00138 FacialExpressionInterface::brows_action() const 00139 { 00140 return data->brows_action; 00141 } 00142 00143 /** Get maximum length of brows_action value. 00144 * @return length of brows_action value, can be length of the array or number of 00145 * maximum number of characters for a string 00146 */ 00147 size_t 00148 FacialExpressionInterface::maxlenof_brows_action() const 00149 { 00150 return 1; 00151 } 00152 00153 /** Set brows_action value. 00154 * Type of action of brows 00155 * @param new_brows_action new brows_action value 00156 */ 00157 void 00158 FacialExpressionInterface::set_brows_action(const brows_t new_brows_action) 00159 { 00160 data->brows_action = new_brows_action; 00161 data_changed = true; 00162 } 00163 00164 /** Get eyes_action value. 00165 * Type of action of eyes 00166 * @return eyes_action value 00167 */ 00168 FacialExpressionInterface::eyes_t 00169 FacialExpressionInterface::eyes_action() const 00170 { 00171 return data->eyes_action; 00172 } 00173 00174 /** Get maximum length of eyes_action value. 00175 * @return length of eyes_action value, can be length of the array or number of 00176 * maximum number of characters for a string 00177 */ 00178 size_t 00179 FacialExpressionInterface::maxlenof_eyes_action() const 00180 { 00181 return 1; 00182 } 00183 00184 /** Set eyes_action value. 00185 * Type of action of eyes 00186 * @param new_eyes_action new eyes_action value 00187 */ 00188 void 00189 FacialExpressionInterface::set_eyes_action(const eyes_t new_eyes_action) 00190 { 00191 data->eyes_action = new_eyes_action; 00192 data_changed = true; 00193 } 00194 00195 /** Get jowl_action value. 00196 * Type of action of jown 00197 * @return jowl_action value 00198 */ 00199 FacialExpressionInterface::jowl_t 00200 FacialExpressionInterface::jowl_action() const 00201 { 00202 return data->jowl_action; 00203 } 00204 00205 /** Get maximum length of jowl_action value. 00206 * @return length of jowl_action value, can be length of the array or number of 00207 * maximum number of characters for a string 00208 */ 00209 size_t 00210 FacialExpressionInterface::maxlenof_jowl_action() const 00211 { 00212 return 1; 00213 } 00214 00215 /** Set jowl_action value. 00216 * Type of action of jown 00217 * @param new_jowl_action new jowl_action value 00218 */ 00219 void 00220 FacialExpressionInterface::set_jowl_action(const jowl_t new_jowl_action) 00221 { 00222 data->jowl_action = new_jowl_action; 00223 data_changed = true; 00224 } 00225 00226 /** Get mouth_action value. 00227 * Type of action of mouth 00228 * @return mouth_action value 00229 */ 00230 FacialExpressionInterface::mouth_t 00231 FacialExpressionInterface::mouth_action() const 00232 { 00233 return data->mouth_action; 00234 } 00235 00236 /** Get maximum length of mouth_action value. 00237 * @return length of mouth_action value, can be length of the array or number of 00238 * maximum number of characters for a string 00239 */ 00240 size_t 00241 FacialExpressionInterface::maxlenof_mouth_action() const 00242 { 00243 return 1; 00244 } 00245 00246 /** Set mouth_action value. 00247 * Type of action of mouth 00248 * @param new_mouth_action new mouth_action value 00249 */ 00250 void 00251 FacialExpressionInterface::set_mouth_action(const mouth_t new_mouth_action) 00252 { 00253 data->mouth_action = new_mouth_action; 00254 data_changed = true; 00255 } 00256 00257 /* =========== message create =========== */ 00258 Message * 00259 FacialExpressionInterface::create_message(const char *type) const 00260 { 00261 if ( strncmp("MoveBrowsMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) { 00262 return new MoveBrowsMessage(); 00263 } else if ( strncmp("MoveEyesMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) { 00264 return new MoveEyesMessage(); 00265 } else if ( strncmp("MoveJowlMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) { 00266 return new MoveJowlMessage(); 00267 } else if ( strncmp("MoveMouthMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) { 00268 return new MoveMouthMessage(); 00269 } else { 00270 throw UnknownTypeException("The given type '%s' does not match any known " 00271 "message type for this interface type.", type); 00272 } 00273 } 00274 00275 00276 /** Copy values from other interface. 00277 * @param other other interface to copy values from 00278 */ 00279 void 00280 FacialExpressionInterface::copy_values(const Interface *other) 00281 { 00282 const FacialExpressionInterface *oi = dynamic_cast<const FacialExpressionInterface *>(other); 00283 if (oi == NULL) { 00284 throw TypeMismatchException("Can only copy values from interface of same type (%s vs. %s)", 00285 type(), other->type()); 00286 } 00287 memcpy(data, oi->data, sizeof(FacialExpressionInterface_data_t)); 00288 } 00289 00290 const char * 00291 FacialExpressionInterface::enum_tostring(const char *enumtype, int val) const 00292 { 00293 if (strcmp(enumtype, "brows_t") == 0) { 00294 return tostring_brows_t((brows_t)val); 00295 } 00296 if (strcmp(enumtype, "eyes_t") == 0) { 00297 return tostring_eyes_t((eyes_t)val); 00298 } 00299 if (strcmp(enumtype, "jowl_t") == 0) { 00300 return tostring_jowl_t((jowl_t)val); 00301 } 00302 if (strcmp(enumtype, "mouth_t") == 0) { 00303 return tostring_mouth_t((mouth_t)val); 00304 } 00305 throw UnknownTypeException("Unknown enum type %s", enumtype); 00306 } 00307 00308 /* =========== messages =========== */ 00309 /** @class FacialExpressionInterface::MoveBrowsMessage <interfaces/FacialExpressionInterface.h> 00310 * MoveBrowsMessage Fawkes BlackBoard Interface Message. 00311 * 00312 00313 */ 00314 00315 00316 /** Constructor with initial values. 00317 * @param ini_brows_action initial value for brows_action 00318 */ 00319 FacialExpressionInterface::MoveBrowsMessage::MoveBrowsMessage(const brows_t ini_brows_action) : Message("MoveBrowsMessage") 00320 { 00321 data_size = sizeof(MoveBrowsMessage_data_t); 00322 data_ptr = malloc(data_size); 00323 memset(data_ptr, 0, data_size); 00324 data = (MoveBrowsMessage_data_t *)data_ptr; 00325 data_ts = (message_data_ts_t *)data_ptr; 00326 data->brows_action = ini_brows_action; 00327 add_fieldinfo(IFT_ENUM, "brows_action", 1, &data->brows_action, "brows_t"); 00328 } 00329 /** Constructor */ 00330 FacialExpressionInterface::MoveBrowsMessage::MoveBrowsMessage() : Message("MoveBrowsMessage") 00331 { 00332 data_size = sizeof(MoveBrowsMessage_data_t); 00333 data_ptr = malloc(data_size); 00334 memset(data_ptr, 0, data_size); 00335 data = (MoveBrowsMessage_data_t *)data_ptr; 00336 data_ts = (message_data_ts_t *)data_ptr; 00337 add_fieldinfo(IFT_ENUM, "brows_action", 1, &data->brows_action, "brows_t"); 00338 } 00339 00340 /** Destructor */ 00341 FacialExpressionInterface::MoveBrowsMessage::~MoveBrowsMessage() 00342 { 00343 free(data_ptr); 00344 } 00345 00346 /** Copy constructor. 00347 * @param m message to copy from 00348 */ 00349 FacialExpressionInterface::MoveBrowsMessage::MoveBrowsMessage(const MoveBrowsMessage *m) : Message("MoveBrowsMessage") 00350 { 00351 data_size = m->data_size; 00352 data_ptr = malloc(data_size); 00353 memcpy(data_ptr, m->data_ptr, data_size); 00354 data = (MoveBrowsMessage_data_t *)data_ptr; 00355 data_ts = (message_data_ts_t *)data_ptr; 00356 } 00357 00358 /* Methods */ 00359 /** Get brows_action value. 00360 * Type of action of brows 00361 * @return brows_action value 00362 */ 00363 FacialExpressionInterface::brows_t 00364 FacialExpressionInterface::MoveBrowsMessage::brows_action() const 00365 { 00366 return data->brows_action; 00367 } 00368 00369 /** Get maximum length of brows_action value. 00370 * @return length of brows_action value, can be length of the array or number of 00371 * maximum number of characters for a string 00372 */ 00373 size_t 00374 FacialExpressionInterface::MoveBrowsMessage::maxlenof_brows_action() const 00375 { 00376 return 1; 00377 } 00378 00379 /** Set brows_action value. 00380 * Type of action of brows 00381 * @param new_brows_action new brows_action value 00382 */ 00383 void 00384 FacialExpressionInterface::MoveBrowsMessage::set_brows_action(const brows_t new_brows_action) 00385 { 00386 data->brows_action = new_brows_action; 00387 } 00388 00389 /** Clone this message. 00390 * Produces a message of the same type as this message and copies the 00391 * data to the new message. 00392 * @return clone of this message 00393 */ 00394 Message * 00395 FacialExpressionInterface::MoveBrowsMessage::clone() const 00396 { 00397 return new FacialExpressionInterface::MoveBrowsMessage(this); 00398 } 00399 /** @class FacialExpressionInterface::MoveEyesMessage <interfaces/FacialExpressionInterface.h> 00400 * MoveEyesMessage Fawkes BlackBoard Interface Message. 00401 * 00402 00403 */ 00404 00405 00406 /** Constructor with initial values. 00407 * @param ini_eyes_action initial value for eyes_action 00408 */ 00409 FacialExpressionInterface::MoveEyesMessage::MoveEyesMessage(const eyes_t ini_eyes_action) : Message("MoveEyesMessage") 00410 { 00411 data_size = sizeof(MoveEyesMessage_data_t); 00412 data_ptr = malloc(data_size); 00413 memset(data_ptr, 0, data_size); 00414 data = (MoveEyesMessage_data_t *)data_ptr; 00415 data_ts = (message_data_ts_t *)data_ptr; 00416 data->eyes_action = ini_eyes_action; 00417 add_fieldinfo(IFT_ENUM, "eyes_action", 1, &data->eyes_action, "eyes_t"); 00418 } 00419 /** Constructor */ 00420 FacialExpressionInterface::MoveEyesMessage::MoveEyesMessage() : Message("MoveEyesMessage") 00421 { 00422 data_size = sizeof(MoveEyesMessage_data_t); 00423 data_ptr = malloc(data_size); 00424 memset(data_ptr, 0, data_size); 00425 data = (MoveEyesMessage_data_t *)data_ptr; 00426 data_ts = (message_data_ts_t *)data_ptr; 00427 add_fieldinfo(IFT_ENUM, "eyes_action", 1, &data->eyes_action, "eyes_t"); 00428 } 00429 00430 /** Destructor */ 00431 FacialExpressionInterface::MoveEyesMessage::~MoveEyesMessage() 00432 { 00433 free(data_ptr); 00434 } 00435 00436 /** Copy constructor. 00437 * @param m message to copy from 00438 */ 00439 FacialExpressionInterface::MoveEyesMessage::MoveEyesMessage(const MoveEyesMessage *m) : Message("MoveEyesMessage") 00440 { 00441 data_size = m->data_size; 00442 data_ptr = malloc(data_size); 00443 memcpy(data_ptr, m->data_ptr, data_size); 00444 data = (MoveEyesMessage_data_t *)data_ptr; 00445 data_ts = (message_data_ts_t *)data_ptr; 00446 } 00447 00448 /* Methods */ 00449 /** Get eyes_action value. 00450 * Type of action of eyes 00451 * @return eyes_action value 00452 */ 00453 FacialExpressionInterface::eyes_t 00454 FacialExpressionInterface::MoveEyesMessage::eyes_action() const 00455 { 00456 return data->eyes_action; 00457 } 00458 00459 /** Get maximum length of eyes_action value. 00460 * @return length of eyes_action value, can be length of the array or number of 00461 * maximum number of characters for a string 00462 */ 00463 size_t 00464 FacialExpressionInterface::MoveEyesMessage::maxlenof_eyes_action() const 00465 { 00466 return 1; 00467 } 00468 00469 /** Set eyes_action value. 00470 * Type of action of eyes 00471 * @param new_eyes_action new eyes_action value 00472 */ 00473 void 00474 FacialExpressionInterface::MoveEyesMessage::set_eyes_action(const eyes_t new_eyes_action) 00475 { 00476 data->eyes_action = new_eyes_action; 00477 } 00478 00479 /** Clone this message. 00480 * Produces a message of the same type as this message and copies the 00481 * data to the new message. 00482 * @return clone of this message 00483 */ 00484 Message * 00485 FacialExpressionInterface::MoveEyesMessage::clone() const 00486 { 00487 return new FacialExpressionInterface::MoveEyesMessage(this); 00488 } 00489 /** @class FacialExpressionInterface::MoveJowlMessage <interfaces/FacialExpressionInterface.h> 00490 * MoveJowlMessage Fawkes BlackBoard Interface Message. 00491 * 00492 00493 */ 00494 00495 00496 /** Constructor with initial values. 00497 * @param ini_jowl_action initial value for jowl_action 00498 */ 00499 FacialExpressionInterface::MoveJowlMessage::MoveJowlMessage(const jowl_t ini_jowl_action) : Message("MoveJowlMessage") 00500 { 00501 data_size = sizeof(MoveJowlMessage_data_t); 00502 data_ptr = malloc(data_size); 00503 memset(data_ptr, 0, data_size); 00504 data = (MoveJowlMessage_data_t *)data_ptr; 00505 data_ts = (message_data_ts_t *)data_ptr; 00506 data->jowl_action = ini_jowl_action; 00507 add_fieldinfo(IFT_ENUM, "jowl_action", 1, &data->jowl_action, "jowl_t"); 00508 } 00509 /** Constructor */ 00510 FacialExpressionInterface::MoveJowlMessage::MoveJowlMessage() : Message("MoveJowlMessage") 00511 { 00512 data_size = sizeof(MoveJowlMessage_data_t); 00513 data_ptr = malloc(data_size); 00514 memset(data_ptr, 0, data_size); 00515 data = (MoveJowlMessage_data_t *)data_ptr; 00516 data_ts = (message_data_ts_t *)data_ptr; 00517 add_fieldinfo(IFT_ENUM, "jowl_action", 1, &data->jowl_action, "jowl_t"); 00518 } 00519 00520 /** Destructor */ 00521 FacialExpressionInterface::MoveJowlMessage::~MoveJowlMessage() 00522 { 00523 free(data_ptr); 00524 } 00525 00526 /** Copy constructor. 00527 * @param m message to copy from 00528 */ 00529 FacialExpressionInterface::MoveJowlMessage::MoveJowlMessage(const MoveJowlMessage *m) : Message("MoveJowlMessage") 00530 { 00531 data_size = m->data_size; 00532 data_ptr = malloc(data_size); 00533 memcpy(data_ptr, m->data_ptr, data_size); 00534 data = (MoveJowlMessage_data_t *)data_ptr; 00535 data_ts = (message_data_ts_t *)data_ptr; 00536 } 00537 00538 /* Methods */ 00539 /** Get jowl_action value. 00540 * Type of action of jown 00541 * @return jowl_action value 00542 */ 00543 FacialExpressionInterface::jowl_t 00544 FacialExpressionInterface::MoveJowlMessage::jowl_action() const 00545 { 00546 return data->jowl_action; 00547 } 00548 00549 /** Get maximum length of jowl_action value. 00550 * @return length of jowl_action value, can be length of the array or number of 00551 * maximum number of characters for a string 00552 */ 00553 size_t 00554 FacialExpressionInterface::MoveJowlMessage::maxlenof_jowl_action() const 00555 { 00556 return 1; 00557 } 00558 00559 /** Set jowl_action value. 00560 * Type of action of jown 00561 * @param new_jowl_action new jowl_action value 00562 */ 00563 void 00564 FacialExpressionInterface::MoveJowlMessage::set_jowl_action(const jowl_t new_jowl_action) 00565 { 00566 data->jowl_action = new_jowl_action; 00567 } 00568 00569 /** Clone this message. 00570 * Produces a message of the same type as this message and copies the 00571 * data to the new message. 00572 * @return clone of this message 00573 */ 00574 Message * 00575 FacialExpressionInterface::MoveJowlMessage::clone() const 00576 { 00577 return new FacialExpressionInterface::MoveJowlMessage(this); 00578 } 00579 /** @class FacialExpressionInterface::MoveMouthMessage <interfaces/FacialExpressionInterface.h> 00580 * MoveMouthMessage Fawkes BlackBoard Interface Message. 00581 * 00582 00583 */ 00584 00585 00586 /** Constructor with initial values. 00587 * @param ini_mouth_action initial value for mouth_action 00588 */ 00589 FacialExpressionInterface::MoveMouthMessage::MoveMouthMessage(const mouth_t ini_mouth_action) : Message("MoveMouthMessage") 00590 { 00591 data_size = sizeof(MoveMouthMessage_data_t); 00592 data_ptr = malloc(data_size); 00593 memset(data_ptr, 0, data_size); 00594 data = (MoveMouthMessage_data_t *)data_ptr; 00595 data_ts = (message_data_ts_t *)data_ptr; 00596 data->mouth_action = ini_mouth_action; 00597 add_fieldinfo(IFT_ENUM, "mouth_action", 1, &data->mouth_action, "mouth_t"); 00598 } 00599 /** Constructor */ 00600 FacialExpressionInterface::MoveMouthMessage::MoveMouthMessage() : Message("MoveMouthMessage") 00601 { 00602 data_size = sizeof(MoveMouthMessage_data_t); 00603 data_ptr = malloc(data_size); 00604 memset(data_ptr, 0, data_size); 00605 data = (MoveMouthMessage_data_t *)data_ptr; 00606 data_ts = (message_data_ts_t *)data_ptr; 00607 add_fieldinfo(IFT_ENUM, "mouth_action", 1, &data->mouth_action, "mouth_t"); 00608 } 00609 00610 /** Destructor */ 00611 FacialExpressionInterface::MoveMouthMessage::~MoveMouthMessage() 00612 { 00613 free(data_ptr); 00614 } 00615 00616 /** Copy constructor. 00617 * @param m message to copy from 00618 */ 00619 FacialExpressionInterface::MoveMouthMessage::MoveMouthMessage(const MoveMouthMessage *m) : Message("MoveMouthMessage") 00620 { 00621 data_size = m->data_size; 00622 data_ptr = malloc(data_size); 00623 memcpy(data_ptr, m->data_ptr, data_size); 00624 data = (MoveMouthMessage_data_t *)data_ptr; 00625 data_ts = (message_data_ts_t *)data_ptr; 00626 } 00627 00628 /* Methods */ 00629 /** Get mouth_action value. 00630 * Type of action of mouth 00631 * @return mouth_action value 00632 */ 00633 FacialExpressionInterface::mouth_t 00634 FacialExpressionInterface::MoveMouthMessage::mouth_action() const 00635 { 00636 return data->mouth_action; 00637 } 00638 00639 /** Get maximum length of mouth_action value. 00640 * @return length of mouth_action value, can be length of the array or number of 00641 * maximum number of characters for a string 00642 */ 00643 size_t 00644 FacialExpressionInterface::MoveMouthMessage::maxlenof_mouth_action() const 00645 { 00646 return 1; 00647 } 00648 00649 /** Set mouth_action value. 00650 * Type of action of mouth 00651 * @param new_mouth_action new mouth_action value 00652 */ 00653 void 00654 FacialExpressionInterface::MoveMouthMessage::set_mouth_action(const mouth_t new_mouth_action) 00655 { 00656 data->mouth_action = new_mouth_action; 00657 } 00658 00659 /** Clone this message. 00660 * Produces a message of the same type as this message and copies the 00661 * data to the new message. 00662 * @return clone of this message 00663 */ 00664 Message * 00665 FacialExpressionInterface::MoveMouthMessage::clone() const 00666 { 00667 return new FacialExpressionInterface::MoveMouthMessage(this); 00668 } 00669 /** Check if message is valid and can be enqueued. 00670 * @param message Message to check 00671 * @return true if the message is valid, false otherwise. 00672 */ 00673 bool 00674 FacialExpressionInterface::message_valid(const Message *message) const 00675 { 00676 const MoveBrowsMessage *m0 = dynamic_cast<const MoveBrowsMessage *>(message); 00677 if ( m0 != NULL ) { 00678 return true; 00679 } 00680 const MoveEyesMessage *m1 = dynamic_cast<const MoveEyesMessage *>(message); 00681 if ( m1 != NULL ) { 00682 return true; 00683 } 00684 const MoveJowlMessage *m2 = dynamic_cast<const MoveJowlMessage *>(message); 00685 if ( m2 != NULL ) { 00686 return true; 00687 } 00688 const MoveMouthMessage *m3 = dynamic_cast<const MoveMouthMessage *>(message); 00689 if ( m3 != NULL ) { 00690 return true; 00691 } 00692 return false; 00693 } 00694 00695 /// @cond INTERNALS 00696 EXPORT_INTERFACE(FacialExpressionInterface) 00697 /// @endcond 00698 00699 00700 } // end namespace fawkes