OpenDDS  Snapshot(2023/04/28-20:55)
DynamicTypeMemberImpl.cpp
Go to the documentation of this file.
1 #include <DCPS/DdsDcps_pch.h>
2 
3 #ifndef OPENDDS_SAFETY_PROFILE
4 
6 
7 #include "DynamicTypeImpl.h"
8 
10 namespace OpenDDS {
11 namespace XTypes {
12 
14 {}
15 
17 {}
18 
20 {
21  // ValueTypes don't have a duplicate so manually add_ref.
22  CORBA::add_ref(descriptor);
23  descriptor_ = descriptor;
24  return DDS::RETCODE_OK;
25 }
26 
28 {
29  DDS::MemberDescriptor_var descriptor_v(descriptor);
30  descriptor = descriptor_;
31  CORBA::add_ref(descriptor);
32  return DDS::RETCODE_OK;
33 }
34 
36 {
37  // FUTURE
38  return 0;
39 }
40 
42 {
43  // FUTURE
45 }
46 
48 {
49  // FUTURE
50  return 0;
51 }
52 
54 {
55  // FUTURE
57 }
58 
59 bool DynamicTypeMemberImpl::equals(DDS::DynamicTypeMember_ptr other)
60 {
61  //7.5.2.6.3 Operation: equals
62  //Two members shall be considered equal if and only if they belong to the same type and all of
63  //their respective properties, as identified in Table 52 above, are equal.
64 
65  //In addition to what the spec says to compare, we will be comparing the MemberDescriptors of both
66  //DynamicTypeMembers. The spec seems to assume this is the case, despite not listing the MemberDescriptor
67  //as a property in table 52. If this were not the case, any two members within a type would be considered
68  //equal, regardless of whether they are actually the same member.
69 
70  DDS::MemberDescriptor_var other_md;
71  if (other->get_descriptor(other_md) != DDS::RETCODE_OK) {
72  return false;
73  }
74 
75  DynamicTypePtrPairSeen dt_ptr_pair;
76  return test_equality(descriptor_, other_md, dt_ptr_pair);
77 }
78 
80 {
81  return descriptor_->id();
82 }
83 
85 {
86  CORBA::String_var s = descriptor_->name();
87  return s._retn();
88 }
89 
90 } // namespace XTypes
91 } // namespace OpenDDS
92 
94 
95 #endif // OPENDDS_SAFETY_PROFILE
ACE_CDR::ULong MemberId
Definition: TypeObject.h:910
DDS::ReturnCode_t get_descriptor(DDS::MemberDescriptor *&descriptor)
DDS::ReturnCode_t get_annotation(DDS::AnnotationDescriptor *&descriptor, CORBA::ULong idx)
bool test_equality(DDS::DynamicType_ptr lhs, DDS::DynamicType_ptr rhs, DynamicTypePtrPairSeen &dt_ptr_pair)
bool equals(DDS::DynamicTypeMember_ptr other)
ACE_CDR::ULong ULong
character_type * _retn(void)
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
const ReturnCode_t RETCODE_OK
const ReturnCode_t RETCODE_UNSUPPORTED
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28
DDS::ReturnCode_t set_descriptor(DDS::MemberDescriptor *descriptor)
DDS::ReturnCode_t get_verbatim_text(DDS::VerbatimTextDescriptor *&descriptor, CORBA::ULong idx)