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

Function vwrite_item

dds/DCPS/XTypes/DynamicVwrite.cpp:574–1008  ·  view source on GitHub ↗

Argument containing_tk and params only apply when this is a member of a struct or union, and is ignored when this is an element of a sequence or array.

Source from the content-addressed store, hash-verified

572// Argument containing_tk and params only apply when this is a member of a struct or union,
573// and is ignored when this is an element of a sequence or array.
574bool vwrite_item(ValueWriter& vw, DDS::DynamicData_ptr value, DDS::MemberId id,
575 const DDS::DynamicType_var& item_type, DDS::TypeKind containing_tk = XTypes::TK_NONE,
576 MemberParam* params = 0)
577{
578 using namespace OpenDDS::XTypes;
579 const DDS::TypeKind item_tk = item_type->get_kind();
580 DDS::TypeKind treat_as;
581 if (get_equivalent_kind(item_type, treat_as) != DDS::RETCODE_OK) {
582 return false;
583 }
584
585 ListEnumHelper enum_helper(treat_as);
586 DDS::TypeDescriptor_var td;
587 if (item_type->get_descriptor(td) != DDS::RETCODE_OK) {
588 return false;
589 }
590 MapBitmaskHelper bitmask_helper(treat_as);
591 if (item_tk == TK_BITMASK) {
592 bitmask_helper.bit_bound(static_cast<ACE_CDR::UShort>(td->bound()[0]));
593 }
594 if ((item_tk == TK_ENUM && !set_enumerated_helper<ACE_CDR::Long>(item_type, enum_helper)) ||
595 (item_tk == TK_BITMASK && !set_enumerated_helper<ACE_CDR::UShort>(item_type, bitmask_helper))) {
596 return false;
597 }
598
599 DDS::ReturnCode_t rc = DDS::RETCODE_OK;
600 switch (treat_as) {
601 case TK_INT8: {
602 CORBA::Int8 val = 0;
603 rc = value->get_int8_value(val, id);
604 if (!check_rc(rc, id, treat_as, "vwrite_item")) {
605 return false;
606 }
607 if (!begin_member_helper(vw, params, rc, containing_tk)) {
608 return false;
609 }
610 if (rc == DDS::RETCODE_OK) {
611 if (item_tk == TK_ENUM) {
612 if (!vw.write_enum(val, enum_helper)) {
613 return false;
614 }
615 } else if (!vw.write_int8(val)) {
616 return false;
617 }
618 } else if (!vw.write_absent_value()) {
619 return false;
620 }
621 break;
622 }
623 case TK_UINT8: {
624 CORBA::UInt8 val = 0;
625 rc = value->get_uint8_value(val, id);
626 if (!check_rc(rc, id, treat_as, "vwrite_item")) {
627 return false;
628 }
629 if (!begin_member_helper(vw, params, rc, containing_tk)) {
630 return false;
631 }

Callers 2

vwrite_memberFunction · 0.85
vwrite_elementFunction · 0.85

Calls 15

get_equivalent_kindFunction · 0.85
begin_member_helperFunction · 0.85
typekind_to_stringFunction · 0.85
retcode_to_stringFunction · 0.85
get_base_typeFunction · 0.85
is_primitiveFunction · 0.85
get_kindMethod · 0.80
boundMethod · 0.80
get_int64_valueMethod · 0.80
get_uint64_valueMethod · 0.80
element_typeMethod · 0.80

Tested by

no test coverage detected