00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <interfaces/FacerInterface.h>
00025
00026 #include <core/exceptions/software.h>
00027
00028 #include <cstring>
00029 #include <cstdlib>
00030
00031 namespace fawkes {
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 FacerInterface::FacerInterface() : Interface()
00049 {
00050 data_size = sizeof(FacerInterface_data_t);
00051 data_ptr = malloc(data_size);
00052 data = (FacerInterface_data_t *)data_ptr;
00053 memset(data_ptr, 0, data_size);
00054 add_fieldinfo(IFT_UINT, "num_identities", 1, &data->num_identities);
00055 add_fieldinfo(IFT_UINT, "recognized_identity", 1, &data->recognized_identity);
00056 add_fieldinfo(IFT_STRING, "recognized_name", 64, data->recognized_name);
00057 add_fieldinfo(IFT_UINT, "num_detections", 1, &data->num_detections);
00058 add_fieldinfo(IFT_UINT, "num_recognitions", 1, &data->num_recognitions);
00059 add_fieldinfo(IFT_UINT, "most_likely_identity", 1, &data->most_likely_identity);
00060 add_fieldinfo(IFT_FLOAT, "history_ratio", 1, &data->history_ratio);
00061 add_fieldinfo(IFT_FLOAT, "sec_since_detection", 1, &data->sec_since_detection);
00062 add_fieldinfo(IFT_INT, "visibility_history", 1, &data->visibility_history);
00063 add_fieldinfo(IFT_BOOL, "learning_in_progress", 1, &data->learning_in_progress);
00064 add_fieldinfo(IFT_FLOAT, "recording_progress", 1, &data->recording_progress);
00065 add_fieldinfo(IFT_FLOAT, "bearing", 1, &data->bearing);
00066 add_fieldinfo(IFT_FLOAT, "slope", 1, &data->slope);
00067 add_fieldinfo(IFT_UINT, "requested_index", 1, &data->requested_index);
00068 add_fieldinfo(IFT_STRING, "requested_name", 64, data->requested_name);
00069 add_messageinfo("LearnFaceMessage");
00070 add_messageinfo("SetOpmodeMessage");
00071 add_messageinfo("EnableIdentityMessage");
00072 add_messageinfo("SetNameMessage");
00073 add_messageinfo("GetNameMessage");
00074 unsigned char tmp_hash[] = {0x2b, 0x6e, 0x8c, 0x6f, 0x9d, 0x2a, 0x9a, 0x3a, 0xe, 0x4, 0x58, 0x50, 0xa4, 0x60, 0x79, 0xa6};
00075 set_hash(tmp_hash);
00076 }
00077
00078
00079 FacerInterface::~FacerInterface()
00080 {
00081 free(data_ptr);
00082 }
00083
00084
00085
00086
00087
00088
00089
00090 FacerInterface::if_facer_opmode_t
00091 FacerInterface::opmode() const
00092 {
00093 return data->opmode;
00094 }
00095
00096
00097
00098
00099
00100 size_t
00101 FacerInterface::maxlenof_opmode() const
00102 {
00103 return 1;
00104 }
00105
00106
00107
00108
00109
00110
00111
00112 void
00113 FacerInterface::set_opmode(const if_facer_opmode_t new_opmode)
00114 {
00115 data->opmode = new_opmode;
00116 }
00117
00118
00119
00120
00121
00122
00123
00124 unsigned int
00125 FacerInterface::num_identities() const
00126 {
00127 return data->num_identities;
00128 }
00129
00130
00131
00132
00133
00134 size_t
00135 FacerInterface::maxlenof_num_identities() const
00136 {
00137 return 1;
00138 }
00139
00140
00141
00142
00143
00144
00145
00146 void
00147 FacerInterface::set_num_identities(const unsigned int new_num_identities)
00148 {
00149 data->num_identities = new_num_identities;
00150 }
00151
00152
00153
00154
00155
00156
00157
00158 unsigned int
00159 FacerInterface::recognized_identity() const
00160 {
00161 return data->recognized_identity;
00162 }
00163
00164
00165
00166
00167
00168 size_t
00169 FacerInterface::maxlenof_recognized_identity() const
00170 {
00171 return 1;
00172 }
00173
00174
00175
00176
00177
00178
00179
00180 void
00181 FacerInterface::set_recognized_identity(const unsigned int new_recognized_identity)
00182 {
00183 data->recognized_identity = new_recognized_identity;
00184 }
00185
00186
00187
00188
00189
00190
00191
00192 char *
00193 FacerInterface::recognized_name() const
00194 {
00195 return data->recognized_name;
00196 }
00197
00198
00199
00200
00201
00202 size_t
00203 FacerInterface::maxlenof_recognized_name() const
00204 {
00205 return 64;
00206 }
00207
00208
00209
00210
00211
00212
00213
00214 void
00215 FacerInterface::set_recognized_name(const char * new_recognized_name)
00216 {
00217 strncpy(data->recognized_name, new_recognized_name, sizeof(data->recognized_name));
00218 }
00219
00220
00221
00222
00223
00224
00225
00226 unsigned int
00227 FacerInterface::num_detections() const
00228 {
00229 return data->num_detections;
00230 }
00231
00232
00233
00234
00235
00236 size_t
00237 FacerInterface::maxlenof_num_detections() const
00238 {
00239 return 1;
00240 }
00241
00242
00243
00244
00245
00246
00247
00248 void
00249 FacerInterface::set_num_detections(const unsigned int new_num_detections)
00250 {
00251 data->num_detections = new_num_detections;
00252 }
00253
00254
00255
00256
00257
00258
00259
00260 unsigned int
00261 FacerInterface::num_recognitions() const
00262 {
00263 return data->num_recognitions;
00264 }
00265
00266
00267
00268
00269
00270 size_t
00271 FacerInterface::maxlenof_num_recognitions() const
00272 {
00273 return 1;
00274 }
00275
00276
00277
00278
00279
00280
00281
00282 void
00283 FacerInterface::set_num_recognitions(const unsigned int new_num_recognitions)
00284 {
00285 data->num_recognitions = new_num_recognitions;
00286 }
00287
00288
00289
00290
00291
00292
00293
00294 unsigned int
00295 FacerInterface::most_likely_identity() const
00296 {
00297 return data->most_likely_identity;
00298 }
00299
00300
00301
00302
00303
00304 size_t
00305 FacerInterface::maxlenof_most_likely_identity() const
00306 {
00307 return 1;
00308 }
00309
00310
00311
00312
00313
00314
00315
00316 void
00317 FacerInterface::set_most_likely_identity(const unsigned int new_most_likely_identity)
00318 {
00319 data->most_likely_identity = new_most_likely_identity;
00320 }
00321
00322
00323
00324
00325
00326
00327
00328
00329 float
00330 FacerInterface::history_ratio() const
00331 {
00332 return data->history_ratio;
00333 }
00334
00335
00336
00337
00338
00339 size_t
00340 FacerInterface::maxlenof_history_ratio() const
00341 {
00342 return 1;
00343 }
00344
00345
00346
00347
00348
00349
00350
00351
00352 void
00353 FacerInterface::set_history_ratio(const float new_history_ratio)
00354 {
00355 data->history_ratio = new_history_ratio;
00356 }
00357
00358
00359
00360
00361
00362
00363
00364 float
00365 FacerInterface::sec_since_detection() const
00366 {
00367 return data->sec_since_detection;
00368 }
00369
00370
00371
00372
00373
00374 size_t
00375 FacerInterface::maxlenof_sec_since_detection() const
00376 {
00377 return 1;
00378 }
00379
00380
00381
00382
00383
00384
00385
00386 void
00387 FacerInterface::set_sec_since_detection(const float new_sec_since_detection)
00388 {
00389 data->sec_since_detection = new_sec_since_detection;
00390 }
00391
00392
00393
00394
00395
00396
00397
00398
00399 int
00400 FacerInterface::visibility_history() const
00401 {
00402 return data->visibility_history;
00403 }
00404
00405
00406
00407
00408
00409 size_t
00410 FacerInterface::maxlenof_visibility_history() const
00411 {
00412 return 1;
00413 }
00414
00415
00416
00417
00418
00419
00420
00421
00422 void
00423 FacerInterface::set_visibility_history(const int new_visibility_history)
00424 {
00425 data->visibility_history = new_visibility_history;
00426 }
00427
00428
00429
00430
00431
00432
00433
00434
00435 bool
00436 FacerInterface::is_learning_in_progress() const
00437 {
00438 return data->learning_in_progress;
00439 }
00440
00441
00442
00443
00444
00445 size_t
00446 FacerInterface::maxlenof_learning_in_progress() const
00447 {
00448 return 1;
00449 }
00450
00451
00452
00453
00454
00455
00456
00457
00458 void
00459 FacerInterface::set_learning_in_progress(const bool new_learning_in_progress)
00460 {
00461 data->learning_in_progress = new_learning_in_progress;
00462 }
00463
00464
00465
00466
00467
00468
00469
00470 float
00471 FacerInterface::recording_progress() const
00472 {
00473 return data->recording_progress;
00474 }
00475
00476
00477
00478
00479
00480 size_t
00481 FacerInterface::maxlenof_recording_progress() const
00482 {
00483 return 1;
00484 }
00485
00486
00487
00488
00489
00490
00491
00492 void
00493 FacerInterface::set_recording_progress(const float new_recording_progress)
00494 {
00495 data->recording_progress = new_recording_progress;
00496 }
00497
00498
00499
00500
00501
00502
00503
00504 float
00505 FacerInterface::bearing() const
00506 {
00507 return data->bearing;
00508 }
00509
00510
00511
00512
00513
00514 size_t
00515 FacerInterface::maxlenof_bearing() const
00516 {
00517 return 1;
00518 }
00519
00520
00521
00522
00523
00524
00525
00526 void
00527 FacerInterface::set_bearing(const float new_bearing)
00528 {
00529 data->bearing = new_bearing;
00530 }
00531
00532
00533
00534
00535
00536
00537
00538 float
00539 FacerInterface::slope() const
00540 {
00541 return data->slope;
00542 }
00543
00544
00545
00546
00547
00548 size_t
00549 FacerInterface::maxlenof_slope() const
00550 {
00551 return 1;
00552 }
00553
00554
00555
00556
00557
00558
00559
00560 void
00561 FacerInterface::set_slope(const float new_slope)
00562 {
00563 data->slope = new_slope;
00564 }
00565
00566
00567
00568
00569
00570
00571
00572 unsigned int
00573 FacerInterface::requested_index() const
00574 {
00575 return data->requested_index;
00576 }
00577
00578
00579
00580
00581
00582 size_t
00583 FacerInterface::maxlenof_requested_index() const
00584 {
00585 return 1;
00586 }
00587
00588
00589
00590
00591
00592
00593
00594 void
00595 FacerInterface::set_requested_index(const unsigned int new_requested_index)
00596 {
00597 data->requested_index = new_requested_index;
00598 }
00599
00600
00601
00602
00603
00604
00605
00606 char *
00607 FacerInterface::requested_name() const
00608 {
00609 return data->requested_name;
00610 }
00611
00612
00613
00614
00615
00616 size_t
00617 FacerInterface::maxlenof_requested_name() const
00618 {
00619 return 64;
00620 }
00621
00622
00623
00624
00625
00626
00627
00628 void
00629 FacerInterface::set_requested_name(const char * new_requested_name)
00630 {
00631 strncpy(data->requested_name, new_requested_name, sizeof(data->requested_name));
00632 }
00633
00634
00635 Message *
00636 FacerInterface::create_message(const char *type) const
00637 {
00638 if ( strncmp("LearnFaceMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
00639 return new LearnFaceMessage();
00640 } else if ( strncmp("SetOpmodeMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
00641 return new SetOpmodeMessage();
00642 } else if ( strncmp("EnableIdentityMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
00643 return new EnableIdentityMessage();
00644 } else if ( strncmp("SetNameMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
00645 return new SetNameMessage();
00646 } else if ( strncmp("GetNameMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
00647 return new GetNameMessage();
00648 } else {
00649 throw UnknownTypeException("The given type '%s' does not match any known "
00650 "message type for this interface type.", type);
00651 }
00652 }
00653
00654
00655
00656
00657
00658 void
00659 FacerInterface::copy_values(const Interface *other)
00660 {
00661 const FacerInterface *oi = dynamic_cast<const FacerInterface *>(other);
00662 if (oi == NULL) {
00663 throw TypeMismatchException("Can only copy values from interface of same type (%s vs. %s)",
00664 type(), other->type());
00665 }
00666 memcpy(data, oi->data, sizeof(FacerInterface_data_t));
00667 }
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680 FacerInterface::LearnFaceMessage::LearnFaceMessage(const char * ini_name) : Message("LearnFaceMessage")
00681 {
00682 data_size = sizeof(LearnFaceMessage_data_t);
00683 data_ptr = malloc(data_size);
00684 memset(data_ptr, 0, data_size);
00685 data = (LearnFaceMessage_data_t *)data_ptr;
00686 strncpy(data->name, ini_name, 64);
00687 add_fieldinfo(IFT_STRING, "name", 64, data->name);
00688 }
00689
00690 FacerInterface::LearnFaceMessage::LearnFaceMessage() : Message("LearnFaceMessage")
00691 {
00692 data_size = sizeof(LearnFaceMessage_data_t);
00693 data_ptr = malloc(data_size);
00694 memset(data_ptr, 0, data_size);
00695 data = (LearnFaceMessage_data_t *)data_ptr;
00696 add_fieldinfo(IFT_STRING, "name", 64, data->name);
00697 }
00698
00699
00700 FacerInterface::LearnFaceMessage::~LearnFaceMessage()
00701 {
00702 free(data_ptr);
00703 }
00704
00705
00706
00707
00708 FacerInterface::LearnFaceMessage::LearnFaceMessage(const LearnFaceMessage *m) : Message("LearnFaceMessage")
00709 {
00710 data_size = m->data_size;
00711 data_ptr = malloc(data_size);
00712 memcpy(data_ptr, m->data_ptr, data_size);
00713 data = (LearnFaceMessage_data_t *)data_ptr;
00714 }
00715
00716
00717
00718
00719
00720
00721 char *
00722 FacerInterface::LearnFaceMessage::name() const
00723 {
00724 return data->name;
00725 }
00726
00727
00728
00729
00730
00731 size_t
00732 FacerInterface::LearnFaceMessage::maxlenof_name() const
00733 {
00734 return 64;
00735 }
00736
00737
00738
00739
00740
00741 void
00742 FacerInterface::LearnFaceMessage::set_name(const char * new_name)
00743 {
00744 strncpy(data->name, new_name, sizeof(data->name));
00745 }
00746
00747
00748
00749
00750
00751
00752 Message *
00753 FacerInterface::LearnFaceMessage::clone() const
00754 {
00755 return new FacerInterface::LearnFaceMessage(this);
00756 }
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767 FacerInterface::SetOpmodeMessage::SetOpmodeMessage(const if_facer_opmode_t ini_opmode) : Message("SetOpmodeMessage")
00768 {
00769 data_size = sizeof(SetOpmodeMessage_data_t);
00770 data_ptr = malloc(data_size);
00771 memset(data_ptr, 0, data_size);
00772 data = (SetOpmodeMessage_data_t *)data_ptr;
00773 data->opmode = ini_opmode;
00774 }
00775
00776 FacerInterface::SetOpmodeMessage::SetOpmodeMessage() : Message("SetOpmodeMessage")
00777 {
00778 data_size = sizeof(SetOpmodeMessage_data_t);
00779 data_ptr = malloc(data_size);
00780 memset(data_ptr, 0, data_size);
00781 data = (SetOpmodeMessage_data_t *)data_ptr;
00782 }
00783
00784
00785 FacerInterface::SetOpmodeMessage::~SetOpmodeMessage()
00786 {
00787 free(data_ptr);
00788 }
00789
00790
00791
00792
00793 FacerInterface::SetOpmodeMessage::SetOpmodeMessage(const SetOpmodeMessage *m) : Message("SetOpmodeMessage")
00794 {
00795 data_size = m->data_size;
00796 data_ptr = malloc(data_size);
00797 memcpy(data_ptr, m->data_ptr, data_size);
00798 data = (SetOpmodeMessage_data_t *)data_ptr;
00799 }
00800
00801
00802
00803
00804
00805
00806
00807
00808 FacerInterface::if_facer_opmode_t
00809 FacerInterface::SetOpmodeMessage::opmode() const
00810 {
00811 return data->opmode;
00812 }
00813
00814
00815
00816
00817
00818 size_t
00819 FacerInterface::SetOpmodeMessage::maxlenof_opmode() const
00820 {
00821 return 1;
00822 }
00823
00824
00825
00826
00827
00828
00829
00830 void
00831 FacerInterface::SetOpmodeMessage::set_opmode(const if_facer_opmode_t new_opmode)
00832 {
00833 data->opmode = new_opmode;
00834 }
00835
00836
00837
00838
00839
00840
00841 Message *
00842 FacerInterface::SetOpmodeMessage::clone() const
00843 {
00844 return new FacerInterface::SetOpmodeMessage(this);
00845 }
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857 FacerInterface::EnableIdentityMessage::EnableIdentityMessage(const unsigned int ini_index, const bool ini_enable) : Message("EnableIdentityMessage")
00858 {
00859 data_size = sizeof(EnableIdentityMessage_data_t);
00860 data_ptr = malloc(data_size);
00861 memset(data_ptr, 0, data_size);
00862 data = (EnableIdentityMessage_data_t *)data_ptr;
00863 data->index = ini_index;
00864 data->enable = ini_enable;
00865 add_fieldinfo(IFT_UINT, "index", 1, &data->index);
00866 add_fieldinfo(IFT_BOOL, "enable", 1, &data->enable);
00867 }
00868
00869 FacerInterface::EnableIdentityMessage::EnableIdentityMessage() : Message("EnableIdentityMessage")
00870 {
00871 data_size = sizeof(EnableIdentityMessage_data_t);
00872 data_ptr = malloc(data_size);
00873 memset(data_ptr, 0, data_size);
00874 data = (EnableIdentityMessage_data_t *)data_ptr;
00875 add_fieldinfo(IFT_UINT, "index", 1, &data->index);
00876 add_fieldinfo(IFT_BOOL, "enable", 1, &data->enable);
00877 }
00878
00879
00880 FacerInterface::EnableIdentityMessage::~EnableIdentityMessage()
00881 {
00882 free(data_ptr);
00883 }
00884
00885
00886
00887
00888 FacerInterface::EnableIdentityMessage::EnableIdentityMessage(const EnableIdentityMessage *m) : Message("EnableIdentityMessage")
00889 {
00890 data_size = m->data_size;
00891 data_ptr = malloc(data_size);
00892 memcpy(data_ptr, m->data_ptr, data_size);
00893 data = (EnableIdentityMessage_data_t *)data_ptr;
00894 }
00895
00896
00897
00898
00899
00900
00901 unsigned int
00902 FacerInterface::EnableIdentityMessage::index() const
00903 {
00904 return data->index;
00905 }
00906
00907
00908
00909
00910
00911 size_t
00912 FacerInterface::EnableIdentityMessage::maxlenof_index() const
00913 {
00914 return 1;
00915 }
00916
00917
00918
00919
00920
00921 void
00922 FacerInterface::EnableIdentityMessage::set_index(const unsigned int new_index)
00923 {
00924 data->index = new_index;
00925 }
00926
00927
00928
00929
00930
00931 bool
00932 FacerInterface::EnableIdentityMessage::is_enable() const
00933 {
00934 return data->enable;
00935 }
00936
00937
00938
00939
00940
00941 size_t
00942 FacerInterface::EnableIdentityMessage::maxlenof_enable() const
00943 {
00944 return 1;
00945 }
00946
00947
00948
00949
00950
00951 void
00952 FacerInterface::EnableIdentityMessage::set_enable(const bool new_enable)
00953 {
00954 data->enable = new_enable;
00955 }
00956
00957
00958
00959
00960
00961
00962 Message *
00963 FacerInterface::EnableIdentityMessage::clone() const
00964 {
00965 return new FacerInterface::EnableIdentityMessage(this);
00966 }
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978 FacerInterface::SetNameMessage::SetNameMessage(const unsigned int ini_index, const char * ini_name) : Message("SetNameMessage")
00979 {
00980 data_size = sizeof(SetNameMessage_data_t);
00981 data_ptr = malloc(data_size);
00982 memset(data_ptr, 0, data_size);
00983 data = (SetNameMessage_data_t *)data_ptr;
00984 data->index = ini_index;
00985 strncpy(data->name, ini_name, 64);
00986 add_fieldinfo(IFT_UINT, "index", 1, &data->index);
00987 add_fieldinfo(IFT_STRING, "name", 64, data->name);
00988 }
00989
00990 FacerInterface::SetNameMessage::SetNameMessage() : Message("SetNameMessage")
00991 {
00992 data_size = sizeof(SetNameMessage_data_t);
00993 data_ptr = malloc(data_size);
00994 memset(data_ptr, 0, data_size);
00995 data = (SetNameMessage_data_t *)data_ptr;
00996 add_fieldinfo(IFT_UINT, "index", 1, &data->index);
00997 add_fieldinfo(IFT_STRING, "name", 64, data->name);
00998 }
00999
01000
01001 FacerInterface::SetNameMessage::~SetNameMessage()
01002 {
01003 free(data_ptr);
01004 }
01005
01006
01007
01008
01009 FacerInterface::SetNameMessage::SetNameMessage(const SetNameMessage *m) : Message("SetNameMessage")
01010 {
01011 data_size = m->data_size;
01012 data_ptr = malloc(data_size);
01013 memcpy(data_ptr, m->data_ptr, data_size);
01014 data = (SetNameMessage_data_t *)data_ptr;
01015 }
01016
01017
01018
01019
01020
01021
01022 unsigned int
01023 FacerInterface::SetNameMessage::index() const
01024 {
01025 return data->index;
01026 }
01027
01028
01029
01030
01031
01032 size_t
01033 FacerInterface::SetNameMessage::maxlenof_index() const
01034 {
01035 return 1;
01036 }
01037
01038
01039
01040
01041
01042 void
01043 FacerInterface::SetNameMessage::set_index(const unsigned int new_index)
01044 {
01045 data->index = new_index;
01046 }
01047
01048
01049
01050
01051
01052 char *
01053 FacerInterface::SetNameMessage::name() const
01054 {
01055 return data->name;
01056 }
01057
01058
01059
01060
01061
01062 size_t
01063 FacerInterface::SetNameMessage::maxlenof_name() const
01064 {
01065 return 64;
01066 }
01067
01068
01069
01070
01071
01072 void
01073 FacerInterface::SetNameMessage::set_name(const char * new_name)
01074 {
01075 strncpy(data->name, new_name, sizeof(data->name));
01076 }
01077
01078
01079
01080
01081
01082
01083 Message *
01084 FacerInterface::SetNameMessage::clone() const
01085 {
01086 return new FacerInterface::SetNameMessage(this);
01087 }
01088
01089
01090
01091
01092
01093
01094
01095
01096
01097
01098 FacerInterface::GetNameMessage::GetNameMessage(const unsigned int ini_index) : Message("GetNameMessage")
01099 {
01100 data_size = sizeof(GetNameMessage_data_t);
01101 data_ptr = malloc(data_size);
01102 memset(data_ptr, 0, data_size);
01103 data = (GetNameMessage_data_t *)data_ptr;
01104 data->index = ini_index;
01105 add_fieldinfo(IFT_UINT, "index", 1, &data->index);
01106 }
01107
01108 FacerInterface::GetNameMessage::GetNameMessage() : Message("GetNameMessage")
01109 {
01110 data_size = sizeof(GetNameMessage_data_t);
01111 data_ptr = malloc(data_size);
01112 memset(data_ptr, 0, data_size);
01113 data = (GetNameMessage_data_t *)data_ptr;
01114 add_fieldinfo(IFT_UINT, "index", 1, &data->index);
01115 }
01116
01117
01118 FacerInterface::GetNameMessage::~GetNameMessage()
01119 {
01120 free(data_ptr);
01121 }
01122
01123
01124
01125
01126 FacerInterface::GetNameMessage::GetNameMessage(const GetNameMessage *m) : Message("GetNameMessage")
01127 {
01128 data_size = m->data_size;
01129 data_ptr = malloc(data_size);
01130 memcpy(data_ptr, m->data_ptr, data_size);
01131 data = (GetNameMessage_data_t *)data_ptr;
01132 }
01133
01134
01135
01136
01137
01138
01139 unsigned int
01140 FacerInterface::GetNameMessage::index() const
01141 {
01142 return data->index;
01143 }
01144
01145
01146
01147
01148
01149 size_t
01150 FacerInterface::GetNameMessage::maxlenof_index() const
01151 {
01152 return 1;
01153 }
01154
01155
01156
01157
01158
01159 void
01160 FacerInterface::GetNameMessage::set_index(const unsigned int new_index)
01161 {
01162 data->index = new_index;
01163 }
01164
01165
01166
01167
01168
01169
01170 Message *
01171 FacerInterface::GetNameMessage::clone() const
01172 {
01173 return new FacerInterface::GetNameMessage(this);
01174 }
01175
01176
01177
01178 bool
01179 FacerInterface::message_valid(const Message *message) const
01180 {
01181 const LearnFaceMessage *m0 = dynamic_cast<const LearnFaceMessage *>(message);
01182 if ( m0 != NULL ) {
01183 return true;
01184 }
01185 const SetOpmodeMessage *m1 = dynamic_cast<const SetOpmodeMessage *>(message);
01186 if ( m1 != NULL ) {
01187 return true;
01188 }
01189 const EnableIdentityMessage *m2 = dynamic_cast<const EnableIdentityMessage *>(message);
01190 if ( m2 != NULL ) {
01191 return true;
01192 }
01193 const SetNameMessage *m3 = dynamic_cast<const SetNameMessage *>(message);
01194 if ( m3 != NULL ) {
01195 return true;
01196 }
01197 const GetNameMessage *m4 = dynamic_cast<const GetNameMessage *>(message);
01198 if ( m4 != NULL ) {
01199 return true;
01200 }
01201 return false;
01202 }
01203
01204
01205 EXPORT_INTERFACE(FacerInterface)
01206
01207
01208
01209 }