MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / member_compare

Function member_compare

dds/DCPS/XTypes/Utils.cpp:509–801  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

507 }
508
509 DDS::ReturnCode_t member_compare(int& result,
510 DDS::DynamicData_ptr a_data, DDS::MemberId a_id,
511 DDS::DynamicData_ptr b_data, DDS::MemberId b_id)
512 {
513 DDS::DynamicType_var a_type;
514 DDS::ReturnCode_t rc = get_member_type(a_type, a_data, a_id);
515 if (rc != DDS::RETCODE_OK) {
516 return rc;
517 }
518 const DDS::TypeKind tk = a_type->get_kind();
519
520 DDS::DynamicType_var b_type;
521 rc = get_member_type(b_type, b_data, b_id);
522 if (rc != DDS::RETCODE_OK) {
523 return rc;
524 }
525 const DDS::TypeKind b_tk = b_type->get_kind();
526
527 if (tk != b_tk) {
528 if (log_level >= LogLevel::Notice) {
529 ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: member_compare: "
530 "trying to compare a %C to a %C\n",
531 typekind_to_string(tk),
532 typekind_to_string(b_tk)));
533 }
534 return DDS::RETCODE_BAD_PARAMETER;
535 }
536
537 DDS::ReturnCode_t a_rc = DDS::RETCODE_OK;
538 DDS::ReturnCode_t b_rc = DDS::RETCODE_OK;
539
540 switch (tk) {
541 case TK_BOOLEAN:
542 {
543 DDS::Boolean a_value = false;
544 a_rc = a_data->get_boolean_value(a_value, a_id);
545 if (a_rc == DDS::RETCODE_OK) {
546 DDS::Boolean b_value = false;
547 b_rc = b_data->get_boolean_value(b_value, b_id);
548 if (b_rc == DDS::RETCODE_OK) {
549 cmp(result, a_value, b_value);
550 }
551 }
552 }
553 break;
554
555 case TK_BYTE:
556 {
557 DDS::Byte a_value;
558 a_rc = a_data->get_byte_value(a_value, a_id);
559 if (a_rc == DDS::RETCODE_OK) {
560 DDS::Byte b_value;
561 b_rc = b_data->get_byte_value(b_value, b_id);
562 if (b_rc == DDS::RETCODE_OK) {
563 cmp(result, a_value, b_value);
564 }
565 }
566 }

Callers 2

less_thanFunction · 0.85
compare_membersFunction · 0.85

Calls 15

typekind_to_stringFunction · 0.85
get_uint_valueFunction · 0.85
get_int_valueFunction · 0.85
get_bitmask_valueFunction · 0.85
retcode_to_stringFunction · 0.85
get_kindMethod · 0.80
get_member_typeFunction · 0.70
cmpFunction · 0.70
get_enum_valueFunction · 0.70
get_boolean_valueMethod · 0.45
get_byte_valueMethod · 0.45
get_float32_valueMethod · 0.45

Tested by

no test coverage detected